parameters: (command, print_output=False,
                             universal_newlines=True,
                             env=os.environ)
return_statement: return output, errout, p.returncode
docstring: Executes a command and returns the output from stdout, stderr and the return code.
  
    Args:
      command: Command to execute.
      print_output: If True, the output is printed to stdout.
                    If False, both stdout and stderr are ignored.
      universal_newlines: Use universal_newlines flag (default: True).
  
    Returns:
      Tuple (stdout, stderr, return code)
docstring_summary: Executes a command and returns the output from stdout, stderr and the return code.
docstring_tokens: Executes a command and returns the output from stdout stderr and the return code .
function: def RunShellWithReturnCodeAndStderr(command, print_output=False,
                             universal_newlines=True,
                             env=os.environ):
    """Executes a command and returns the output from stdout, stderr and the return code.
  
    Args:
      command: Command to execute.
      print_output: If True, the output is printed to stdout.
                    If False, both stdout and stderr are ignored.
      universal_newlines: Use universal_newlines flag (default: True).
  
    Returns:
      Tuple (stdout, stderr, return code)
    """
    logging.info("Running %s", command)
    env = env.copy()
    env['LC_MESSAGES'] = 'C'
    p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                         shell=use_shell, universal_newlines=universal_newlines,
                         env=env)
    if print_output:
      output_array = []
      while True:
        line = p.stdout.readline()
        if not line:
          break
        print line.strip("\n")
        output_array.append(line)
      output = "".join(output_array)
    else:
      output = p.stdout.read()
    p.wait()
    errout = p.stderr.read()
    if print_output and errout:
      print >>sys.stderr, errout
    p.stdout.close()
    p.stderr.close()
    return output, errout, p.returncode
function_tokens: def RunShellWithReturnCodeAndStderr ( command , print_output = False , universal_newlines = True , env = os . environ ) : logging . info ( "Running %s" , command ) env = env . copy ( ) env [ 'LC_MESSAGES' ] = 'C' p = subprocess . Popen ( command , stdout = subprocess . PIPE , stderr = subprocess . PIPE , shell = use_shell , universal_newlines = universal_newlines , env = env ) if print_output : output_array = [ ] while True : line = p . stdout . readline ( ) if not line : break print line . strip ( "\n" ) output_array . append ( line ) output = "" . join ( output_array ) else : output = p . stdout . read ( ) p . wait ( ) errout = p . stderr . read ( ) if print_output and errout : print >> sys . stderr , errout p . stdout . close ( ) p . stderr . close ( ) return output , errout , p . returncode