@staticmethod
def _gen_memd_wrappers_retarget(cls, factory):
    """Generates wrappers for all the memcached operations.
        :param factory: A function to be called to return the wrapped
            method. It will be called with two arguments; the first is
            the unbound method being wrapped, and the second is the name
            of such a method.

          The factory shall return a new unbound method

        :return: A dictionary of names mapping the API calls to the
            wrapped functions
        """
    d = {}
    for n in cls._MEMCACHED_OPERATIONS:
        for variant in (n, n + '_multi'):
            try:
                d[variant] = factory(getattr(cls, variant), variant)
            except AttributeError:
                if n in cls._MEMCACHED_NOMULTI:
                    continue
                raise
    return d
