code: def Popen(*args, **kwargs):
      
  
      read_line = None
      if 'read_line' in kwargs:
          read_line = kwargs['read_line']
          del kwargs['read_line']
  
      p = subprocess.Popen(*args, **kwargs)
      wait_stdout = None
      wait_stderr = None
  
      if p.stdout:
          wait_stdout = sys.stdout.attach(p.stdout, read_line=read_line)
      if p.stderr:
          wait_stderr = sys.stderr.attach(p.stderr)
  
      original_wait = p.wait
      def wait():
          original_wait()
  
          if wait_stdout:
              wait_stdout()
          if wait_stderr:
              wait_stderr()
  
      p.wait = wait
  
      return p
docs: Executes a command using subprocess.Popen and redirects output to AETROS and stdout.
      Parses stdout as well for stdout API calls.
  
      Use read_line argument to read stdout of command's stdout line by line.
      Use returned process stdin to communicate with the command.
  
      :return: subprocess.Popen