def deprecate(name, alternative, version, alt_name=None,<EOL>klass=None, stacklevel=<NUM_LIT:2>, msg=None):
alt_name = alt_name or alternative.__name__<EOL>klass = klass or FutureWarning<EOL>warning_msg = msg or '<STR_LIT>'.format(name,<EOL>alt_name)<EOL>@wraps(alternative)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>warnings.warn(warning_msg, klass, stacklevel=stacklevel)<EOL>return alternative(*args, **kwargs)<EOL><DEDENT>msg = msg or '<STR_LIT>'.format(alt_name=alt_name)<EOL>doc_error_msg = ('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(alternative.__doc__))<EOL>if alternative.__doc__:<EOL><INDENT>if alternative.__doc__.count('<STR_LIT:\n>') < <NUM_LIT:3>:<EOL><INDENT>raise AssertionError(doc_error_msg)<EOL><DEDENT>empty1, summary, empty2, doc = alternative.__doc__.split('<STR_LIT:\n>', <NUM_LIT:3>)<EOL>if empty1 or empty2 and not summary:<EOL><INDENT>raise AssertionError(doc_error_msg)<EOL><DEDENT>wrapper.__doc__ = dedent("""<STR_LIT>""").format(summary=summary.strip(),<EOL>depr_version=version,<EOL>depr_msg=msg,<EOL>rest_of_docstring=dedent(doc))<EOL><DEDENT>return wrapper<EOL>
Return a new function that emits a deprecation warning on use.

To use this method for a deprecated function, another function
`alternative` with the same signature must exist. The deprecated
function will emit a deprecation warning, and in the docstring
it will contain the deprecation directive with the provided version
so it can be detected for future removal.

Parameters
----------
name : str
    Name of function to deprecate.
alternative : func
    Function to use instead.
version : str
    Version of pandas in which the method has been deprecated.
alt_name : str, optional
    Name to use in preference of alternative.__name__.
klass : Warning, default FutureWarning
stacklevel : int, default 2
msg : str
    The message to display in the warning.
    Default is '{name} is deprecated. Use {alt_name} instead.'