Decorate a function to emit a deprecation warning with the given
        message.

def deprecate(message):
    """
        Decorate a function to emit a deprecation warning with the given
        message.
    """
    @decorator
    def decorate(fn, *args, **kw):
        warnings.warn(message, DeprecationWarning, 2)
        return fn(*args, **kw)
    return decorate