1import subprocess
2
3
4def execute_cmd(parms_string, quiet=False):
5    r"""
6    Run CLI standard tool or scripts.
7
8    Description of variable:
9    parms_string         Command to execute from the current SHELL.
10    quiet                do not print tool error message if True
11    """
12
13    result = subprocess.run(
14        [parms_string],
15        stdout=subprocess.PIPE,
16        stderr=subprocess.PIPE,
17        shell=True,
18        universal_newlines=True,
19    )
20
21    if result.stderr and not quiet:
22        print("\n\t\tERROR with %s " % parms_string)
23        print("\t\t" + result.stderr)
24
25    return result.stdout
26