code: def run(command, verbose=False):
      
      def do_nothing(*args, **kwargs):
          return None
  
      v_print = print if verbose else do_nothing
  
      p = subprocess.Popen(
          command,
          shell=True,
          stdout=subprocess.PIPE,
          stderr=subprocess.STDOUT,
          universal_newlines=True,
      )
  
      v_print("run:", command)
  
      def log_and_yield(line):
          if six.PY2:
              # If not unicode, try to decode it first
              if isinstance(line, str):
                  line = line.decode('utf8', 'replace')
          v_print(line)
          return line
  
      output = ''.join(map(log_and_yield, p.stdout))
      status_code = p.wait()
  
      return CommandResult(command, output, status_code)
docs: Run a shell command.  Capture the stdout and stderr as a single stream.
      Capture the status code.
  
      If verbose=True, then print command and the output to the terminal as it
      comes in.