human
Complete this python program:
def decorator(target):
assistant
#Here is the Python program you requested.

    """A signature-matching decorator factory.
    """
    def decorate(fn):
        if (not inspect.isfunction(fn)):
            raise Exception('not    a    decoratable    function')
        spec = compat.inspect_getfullargspec(fn)
        names = ((tuple(spec[0]) + spec[1:3]) + (fn.__name__,))
        (targ_name, fn_name) = _unique_symbols(names, 'target', 'fn')
        metadata = dict(target=targ_name, fn=fn_name)
        metadata.update(format_argspec_plus(spec, grouped=False))
        metadata['name'] = fn.__name__
        code = ('def    %(name)s(%(args)s):\n                return    %(target)s(%(fn)s,    %(apply_kw)s)\n' % metadata)
        decorated = _exec_code_in_env(code, {targ_name: target, fn_name: fn}, fn.__name__)
        decorated.__defaults__ = getattr(fn, 'im_func', fn).__defaults__
        decorated.__wrapped__ = fn
        return update_wrapper(decorated, fn)
    return update_wrapper(decorate, target)