def Exec(cmd, stdin=None):
  """Executes a process and returns exit code, stdout, stderr.

  Args:
    cmd: str or sequence, command and optional arguments to execute.
    stdin: str, optional, to send to standard in.
  Returns:
    Tuple. (Integer return code, string standard out, string standard error).
  Raises:
    ExecError: When an error occurs while executing cmd. Exec did not complete.
  """
  shell = isinstance(cmd, basestring)
  logging.debug('Exec(%s, shell=%s)', cmd, shell)
  try:
    p = subprocess.Popen(
        cmd, shell=shell,
        stderr=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  except __HOLE__ as e:
    raise ExecError(str(e))
  stdout, stderr = p.communicate(stdin)
  return p.returncode, stdout, stderr
dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/client/util.py/Exec