human
Complete this python program:
def deprecated(version, message=None, add_deprecation_to_docstring=True):
assistant
#Here is the Python code you requested.

    """Decorates a function and issues a deprecation warning on use.
    :param message:
    If provided, issue message in the warning.  A sensible default
    is used if not provided.
    :param add_deprecation_to_docstring:
    Default True.  If False, the wrapped function\s __doc__ is left
    as-is.  If True, the \message\ is prepended to the docs if
    provided, or sensible default if message is omitted.
    """
    if add_deprecation_to_docstring:
        header = ('..    deprecated::    %s    %s' % (version, (message or '')))
    else:
        header = None
    if (message is None):
        message = 'Call    to    deprecated    function    %(func)s'
    def decorate(fn):
        return _decorate_with_warning(fn, exc.SADeprecationWarning, (message % dict(func=fn.__name__)), header)
    return decorate