human
Complete this python program:
def lazy(func, *resultclasses):
assistant
#Here is the Python program you requested.

    """Turns any callable into a lazy evaluated callable. You need to give result
    classes or types -- at least one is needed so that the automatic forcing of
    the lazy evaluation code is triggered. Results are not memoized; the
    function is evaluated on every access.
    """
    class __proxy__(Promise, ):
        def __init__(self, args, kw):
            self.__func = func
            self.__args = args
            self.__kw = kw
            self.__dispatch = {}
            for resultclass in resultclasses:
                self.__dispatch[resultclass] = {}
                for (k, v) in resultclass.__dict__.items():
                    setattr(self, k, self.__promise__(resultclass, k, v))
        def __promise__(self, klass, funcname, func):
            def __wrapper__(*args, **kw):
                res = self.__func(*self.__args, **self.__kw)
                return self.__dispatch[type(res)][funcname](res, *args, **kw)
            if (not self.__dispatch.has_key(klass)):
                self.__dispatch[klass] = {}
            self.__dispatch[klass][funcname] = func
            return __wrapper__
    def __wrapper__(*args, **kw):
        return __proxy__(args, kw)
    return __wrapper__