code: def run_command(args, asynchronous=False):
      
      logging.info("Executing %s command %s.",
                   asynchronous and 'asynchronous' or 'synchronous', args)
  
      process = subprocess.Popen(args,
                                 shell=True,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.STDOUT)
  
      try:
          timeout = asynchronous and 1 or None
          output = process.communicate(timeout=timeout)[0].decode('utf8')
      except subprocess.TimeoutExpired:
          pass
  
      if asynchronous:
          return PopenOutput(None, 'Asynchronous call.')
      else:
          return PopenOutput(process.returncode, output)
docs: Executes a command returning its exit code and output.