def _run_command(<EOL>command,<EOL>input_data=None,<EOL>stdin=None,<EOL>out_pipe=subprocess.PIPE,<EOL>err_pipe=subprocess.PIPE,<EOL>env=None,<EOL>uuid=None,<EOL>**kwargs<EOL>):
<EOL>if uuid is None:<EOL><INDENT>uuid = uuid_m.uuid4()<EOL><DEDENT>if constants.LIBEXEC_DIR not in os.environ['<STR_LIT>'].split('<STR_LIT::>'):<EOL><INDENT>os.environ['<STR_LIT>'<EOL>] = '<STR_LIT>' % (constants.LIBEXEC_DIR, os.environ['<STR_LIT>'])<EOL><DEDENT>if input_data and not stdin:<EOL><INDENT>kwargs['<STR_LIT>'] = subprocess.PIPE<EOL><DEDENT>elif stdin:<EOL><INDENT>kwargs['<STR_LIT>'] = stdin<EOL><DEDENT>if env is None:<EOL><INDENT>env = os.environ.copy()<EOL><DEDENT>else:<EOL><INDENT>env['<STR_LIT>'] = '<STR_LIT::>'.join(<EOL>list(<EOL>set(<EOL>env.get('<STR_LIT>', '<STR_LIT>').split('<STR_LIT::>') + os.environ['<STR_LIT>']<EOL>.split('<STR_LIT::>')<EOL>),<EOL>),<EOL>)<EOL><DEDENT>popen = subprocess.Popen(<EOL>'<STR_LIT:U+0020>'.join('<STR_LIT>' % arg for arg in command),<EOL>stdout=out_pipe,<EOL>stderr=err_pipe,<EOL>shell=True,<EOL>env=env,<EOL>**kwargs<EOL>)<EOL>out, err = popen.communicate(input_data)<EOL>LOGGER.debug(<EOL>'<STR_LIT>', str(uuid), popen.returncode<EOL>)<EOL>if out:<EOL><INDENT>LOGGER.debug('<STR_LIT>', str(uuid), out)<EOL><DEDENT>if err:<EOL><INDENT>LOGGER.debug('<STR_LIT>', str(uuid), err)<EOL><DEDENT>return CommandStatus(popen.returncode, out, err)<EOL>
Runs a command

Args:
    command(list of str): args of the command to execute, including the
        command itself as command[0] as `['ls', '-l']`
    input_data(str): If passed, will feed that data to the subprocess
        through stdin
    out_pipe(int or file): File descriptor as passed to
        :ref:subprocess.Popen to use as stdout
    stdin(int or file): File descriptor as passed to
        :ref:subprocess.Popen to use as stdin
    err_pipe(int or file): File descriptor as passed to
        :ref:subprocess.Popen to use as stderr
    env(dict of str:str): If set, will use the given dict as env for the
        subprocess
    uuid(uuid): If set the command will be logged with the given uuid
        converted to string, otherwise, a uuid v4 will be generated.
    **kwargs: Any other keyword args passed will be passed to the
        :ref:subprocess.Popen call

Returns:
    lago.utils.CommandStatus: result of the interactive execution