def METHOD_NAME(fake_out, fake_err):
  def fake_subprocess_popen(command, stdout, stderr, shell):
    del command, shell  # Unused by the fake but needed by the real version.
    stdout.write(fake_out)
    stderr.write(fake_err)
    m = mock.create_autospec(subprocess.Popen, instance=True)
    m.wait.return_value = 0
    return m
  return fake_subprocess_popen