def deprecated(warning=None):
  """Decorator to raise warning each time the function is called.

  Args:
    warning: The warning message to be displayed as a string (optinoal).
  """
  warning = warning or ''
  # This closure is what is returned from the deprecated function.
  def mark_deprecated(f):
    # The deprecated_function wraps the actual call to f.
    def deprecated_function(*args, **kwargs):
      warnings.warn(warning, DeprecationWarning, stacklevel=2)
      return f(*args, **kwargs)
    # Preserve the original name to avoid masking all decorated functions as
    # 'deprecated_function'
    try:
      deprecated_function.func_name = f.func_name
    except __HOLE__:
      # Setting the func_name is not allowed in Python2.3.
      pass
    return deprecated_function
  return mark_deprecated
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/atom/__init__.py/deprecated