<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delegate_method(other, method, name=None):
 """Add a method to the current class that delegates to another method. The *other* argument must be a property that returns the instance to delegate to. Due to an implementation detail, the property must be defined in the current class. The *method* argument specifies a method to delegate to. It can be any callable as long as it takes the instances as its first argument. It is a common paradigm in Gruvi to expose protocol methods onto clients. This keeps most of the logic into the protocol, but prevents the user from having to type ``'client.protocol.*methodname*'`` all the time. For example:: class MyClient(Client):
 protocol = Client.protocol delegate_method(protocol, MyProtocol.method) """

    frame = sys._getframe(1)
    classdict = frame.f_locals

    @functools.wraps(method)
    def delegate(self, *args, **kwargs):
        other_self = other.__get__(self)
        return method(other_self, *args, **kwargs)

    if getattr(method, '__switchpoint__', False):
        delegate.__switchpoint__ = True

    if name is None:
        name = method.__name__
    propname = None
    for key in classdict:
        if classdict[key] is other:
            propname = key
            break
    # If we know the property name, replace the docstring with a small
    # reference instead of copying the function docstring.
    if propname:
        qname = getattr(method, '__qualname__', method.__name__)
        if '.' in qname:
            delegate.__doc__ = 'A shorthand for ``self.{propname}.{name}()``.' \
                               .format(name=name, propname=propname)
        else:
            delegate.__doc__ = 'A shorthand for ``{name}({propname}, ...)``.' \
                               .format(name=name, propname=propname)
    classdict[name] = delegate