human
Complete this python program:
def _enhook(klass, name):
assistant
#Here is the Python code you requested.

    """(private) causes a certain method name to be hooked on a class
    """
    if hasattr(klass, ORIG(klass, name)):
        return
    def newfunc(*args, **kw):
        for preMethod in getattr(klass, PRE(klass, name)):
            preMethod(*args, **kw)
        try:
            return getattr(klass, ORIG(klass, name))(*args, **kw)
        finally:
            for postMethod in getattr(klass, POST(klass, name)):
                postMethod(*args, **kw)
    try:
        newfunc.func_name = name
    except TypeError:
        pass
    oldfunc = getattr(klass, name).im_func
    setattr(klass, ORIG(klass, name), oldfunc)
    setattr(klass, PRE(klass, name), [])
    setattr(klass, POST(klass, name), [])
    setattr(klass, name, newfunc)