def run_command(cmd, sudo=False):
if sudo is True:<EOL><INDENT>cmd = ['<STR_LIT>'] + cmd<EOL><DEDENT>try:<EOL><INDENT>output = Popen(cmd, stderr=STDOUT, stdout=PIPE)<EOL><DEDENT>except FileNotFoundError:<EOL><INDENT>cmd.pop(<NUM_LIT:0>)<EOL>output = Popen(cmd, stderr=STDOUT, stdout=PIPE)<EOL><DEDENT>t = output.communicate()[<NUM_LIT:0>],output.returncode<EOL>output = {'<STR_LIT:message>':t[<NUM_LIT:0>],<EOL>'<STR_LIT>':t[<NUM_LIT:1>]}<EOL>if isinstance(output['<STR_LIT:message>'], bytes):<EOL><INDENT>output['<STR_LIT:message>'] = output['<STR_LIT:message>'].decode('<STR_LIT:utf-8>')<EOL><DEDENT>return output<EOL>
run_command uses subprocess to send a command to the terminal.

    Parameters
    ==========
    cmd: the command to send, should be a list for subprocess
    error_message: the error message to give to user if fails,
    if none specified, will alert that command failed.