Provide static access to underscore class

def makeStatic():
        """ Provide static access to underscore class
        """
        p = lambda value: inspect.ismethod(value) or inspect.isfunction(value)
        for eachMethod in inspect.getmembers(underscore,
                                             predicate=p):
            m = eachMethod[0]
            if not hasattr(_, m):
                def caller(a):
                    def execute(*args):
                        if len(args) == 1:
                            r = getattr(underscore(args[0]), a)()
                        elif len(args) > 1:
                            rargs = args[1:]
                            r = getattr(underscore(args[0]), a)(*rargs)
                        else:
                            r = getattr(underscore([]), a)()
                        return r
                    return execute
                _.__setattr__(m, caller(m))
        # put the class itself as a parameter so that we can use it on outside
        _.__setattr__("underscore", underscore)
        _.templateSettings = {}