'Update the signature of func with the data in self'

def update(self, func, **kw):

    func.__name__ = self.name
    func.__doc__ = getattr(self, 'doc', None)
    func.__dict__ = getattr(self, 'dict', {})
    func.__defaults__ = getattr(self, 'defaults', ())
    func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None)
    func.__annotations__ = getattr(self, 'annotations', None)
    try:
        frame = sys._getframe(3)
    except AttributeError:
        callermodule = '?'
    else:
        callermodule = frame.f_globals.get('__name__', '?')
    func.__module__ = getattr(self, 'module', callermodule)
    func.__dict__.update(kw)
