def METHOD_NAME(target: Callable, new: Callable):
    """
    Creates a proxy that calls `new` but passes as first argument the target.
    """
    @functools.wraps(target)
    def proxy(*args, **kwargs):
        if _is_bound_method:
            # bound object "self" is passed as first argument if this is a bound method
            args = args[1:]
        return new(target, *args, **kwargs)
    _is_bound_method = inspect.ismethod(target)
    if _is_bound_method:
        proxy = types.MethodType(proxy, target.__self__)
    return proxy