def wrap(self, wrapper):
        """
        Returns the first function passed as an argument to the second,
        allowing you to adjust arguments, run code before and after, and
        conditionally execute the original function.
        """
        def wrapped(*args, **kwargs):

            if kwargs:
                kwargs["object"] = self.obj
            else:
                args = list(args)
                args.insert(0, self.obj)

            return wrapper(*args, **kwargs)

        return self._wrap(wrapped)
def wrap ( self , wrapper ) : def wrapped ( * args , ** kwargs ) : if kwargs : kwargs [ "object" ] = self . obj else : args = list ( args ) args . insert ( 0 , self . obj ) return wrapper ( * args , ** kwargs ) return self . _wrap ( wrapped )
Returns the first function passed as an argument to the second,
        allowing you to adjust arguments, run code before and after, and
        conditionally execute the original function.