def rename_kw(old_name, old_value, new_name, new_value,<EOL>version_deprecated, version_removed):
if isinstance(old_value, Deprecated):<EOL><INDENT>return new_value<EOL><DEDENT>else:<EOL><INDENT>stack = inspect.stack()<EOL>dep_func = stack[<NUM_LIT:1>]<EOL>caller = stack[<NUM_LIT:2>]<EOL>warnings.warn_explicit("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(dep_func[<NUM_LIT:3>],<EOL>old_name, new_name,<EOL>version_deprecated,<EOL>version_removed),<EOL>category=DeprecationWarning,<EOL>filename=caller[<NUM_LIT:1>],<EOL>lineno=caller[<NUM_LIT:2>])<EOL>return old_value<EOL><DEDENT>
Handle renamed arguments.

    Parameters
    ----------
    old_name : str
    old_value
        The name and value of the old argument

    new_name : str
    new_value
        The name and value of the new argument

    version_deprecated : str
        The version at which the old name became deprecated

    version_removed : str
        The version at which the old name will be removed

    Returns
    -------
    value
        - `new_value` if `old_value` of type `Deprecated`
        - `old_value` otherwise

    Warnings
    --------
    if `old_value` is not of type `Deprecated`