'Magic to hook various function calls in sslstrip'

def hook(self):

    frame = sys._getframe(1)
    fname = frame.f_code.co_name
    (keys, _, _, values) = inspect.getargvalues(frame)
    args = {}
    for key in keys:
        args[key] = values[key]
    args['request'] = args['self']
    del args['self']
    try:
        for f in self.pmthds[fname]:
            a = f(**args)
            if (a != None):
                args = a
    except KeyError:
        pass
    return args
