Part of twisted.python View Source
To mark a method or function as being deprecated do this:
   def badAPI(self, first, second):
       '''
       Docstring for badAPI.
       '''
       ...
   badAPI = deprecate(Version("Twisted", 8, 0, 0))(badAPI)
The newly-decorated badAPI will issue a warning when called. It will also have a deprecation notice appended to its docstring.
To mark module-level attributes as being deprecated you can use:
   badAttribute = "someValue"
   ...
   deprecatedModuleAttributes(
       Version("Twisted", 8, 0, 0),
       "Use goodAttribute instead.",
       "your.full.module.name",
       "badAttribute")
The deprecated attributes will issue a warning whenever they are 
accessed. If the attributes being deprecated are in the same module as the 
deprecatedModuleAttributes call is being made from, the 
__name__ global can be used as the moduleName 
parameter.
See also Version.
| Variables | DEPRECATION_WARNING_FORMAT | The default deprecation warning string format to use when one is not 
provided by the user.
 (type: str
) | 
| Function | getWarningMethod | Return the warning method currently used to record deprecation warnings. | 
| Function | setWarningMethod | Set the warning method to use to record deprecation warnings. | 
| Function | getDeprecationWarningString | Return a string indicating that the callable was deprecated in the given | 
| Function | deprecated | Return a decorator that marks callables as deprecated. | 
| Function | deprecatedModuleAttribute | Declare a module-level attribute as being deprecated. | 
| Function | _getDeprecationDocstring | Undocumented | 
| Function | _getDeprecationWarningString | Return a string indicating that the Python name was deprecated in the given | 
| Function | _appendToDocstring | Append the given text to the docstring of thingWithDoc. | 
  
| Class | _ModuleProxy | Python module wrapper to hook module-level attribute access. | 
| Class | _DeprecatedAttribute | Wrapper for deprecated attributes. | 
| Function | _deprecateAttribute | Mark a module-level attribute as being deprecated. | 
The callable should take message, category and stacklevel. The return value is ignored.
| Parameters | fqpn | Fully qualified Python name of the thing being deprecated
 (type: str
) | 
| version | Version that fqpn was deprecated in
 (type: twisted.python.versions.Version
) | |
| format | A user-provided format to interpolate warning values into, or 
DEPRECATION_WARNING_FORMAT if None is given
 (type: str
) | |
| Returns | A textual description of the deprecation
 (type: str
) | |
| Parameters | callableThing | Callable object to be deprecated
 (type: callable
) | 
| version | Version that fqpn was deprecated in
 (type: twisted.python.versions.Version
) | |
| format | A user-provided format to interpolate warning values into, or 
DEPRECATION_WARNING_FORMAT if None is given
 (type: str
) | |
| Returns | A textual description of the deprecation
 (type: str
) | |
| Parameters | version | The version in which the callable will be marked as having been deprecated.
The decorated function will be annotated with this version, having it set 
as its deprecatedVersion attribute.
 (type: twisted.python.versions.Version
) | 
thingWithDoc.
If thingWithDoc has no docstring, then the text just 
replaces the docstring. If it has a single-line docstring then it appends a
blank line and the message text. If it has a multi-line docstring, then in 
appends a blank line a the message text, and also does the indentation 
correctly.
| Parameters | proxy | The module proxy instance proxying the deprecated attributes
 (type: _ModuleProxy
) | 
| name | Attribute name
 (type: str
) | |
| version | Version that the attribute was deprecated in
 (type: twisted.python.versions.Version
) | |
| message | Deprecation message
 (type: str
) | 
| Parameters | version | Version that the attribute was deprecated in
 (type: twisted.python.versions.Version
) | 
| message | Deprecation message
 (type: str
) | |
| moduleName | Fully-qualified Python name of the module containing the deprecated 
attribute; if called from the same module as the attributes are being 
deprecated in, using the __name__ global can be helpful
 (type: str
) | |
| name | Attribute name to deprecate
 (type: str
) |