@functools.wraps(func)
def decorated(*args: P.args, **kwargs: P.kwargs) -> T:
    warnings.simplefilter('always', DeprecationWarning)
    if instead:
        fmt = '{0.__name__} is deprecated, use {1} instead.'
    else:
        fmt = '{0.__name__} is deprecated.'
    warnings.warn(fmt.format(func, instead), stacklevel=3, category=DeprecationWarning)
    warnings.simplefilter('default', DeprecationWarning)
    return func(*args, **kwargs)
@functools.wraps(func)
def decorated(*args: P.args, **kwargs: P.kwargs) -> T:
    warnings.simplefilter('always', DeprecationWarning)
    if instead:
        fmt = '{0.__name__} is deprecated, use {1} instead.'
    else:
        fmt = '{0.__name__} is deprecated.'
    warnings.warn(fmt.format(func, instead), stacklevel=3, category=DeprecationWarning)
    warnings.simplefilter('default', DeprecationWarning)
    return func(*args, **kwargs)