def NeedsOriginal(func):
  """A decorator that indicates the original patch value should be supplied.

  Args:
    func: A callable that is going to be used in a patch.

  Returns:
    The supplied function, with the needs_original attribute added.

  When @NeedsOriginal is used, the original value of the patched function
  will be inserted as the first argument.  For example, one might patch
  open() as follows:

  @patch.NeedsOriginal
  def CustomOpen(original, filename, mode='r', bufsize=-1):
    ...
  """
  func.needs_original = True  # the actual value of the attribute doesn't matter
  return func