human
I wrote the below code

    def _dec(obj):
        is_class = isinstance(obj, type)
        if is_class:
            if (name and hasattr(obj, name)):
                func = getattr(obj, name)
                if (not callable(func)):
                    raise TypeError("Cannot    decorate    '{0}'    as    it    isn't    a    callable    attribute    of    {1}    ({2})".format(name, obj, func))
            else:
                raise ValueError("The    keyword    argument    `name`    must    be    the    name    of    a    method    of    the    decorated    class:    {0}.    Got    '{1}'    instead".format(obj, name))
        else:
            func = obj
        def decorate(function):
            '\n                                                Apply    a    list/tuple    of    decorators    if    decorator    is    one.    Decorator\n                                                functions    are    applied    so    that    the    call    order    is    the    same    as    the\n                                                order    in    which    they    appear    in    the    iterable.\n                                                '
            if hasattr(decorator, '__iter__'):
                for dec in decorator[::(-1)]:
                    function = dec(function)
                return function
            return decorator(function)
        def _wrapper(self, *args, **kwargs):
            @decorate
            def bound_func(*args2, **kwargs2):
                return func.__get__(self, type(self))(*args2, **kwargs2)
            return bound_func(*args, **kwargs)
        @decorate
        def dummy(*args, **kwargs):
            pass
        update_wrapper(_wrapper, dummy)
        update_wrapper(_wrapper, func)
        if is_class:
            setattr(obj, name, _wrapper)
            return obj
        return _wrapper
    if (not hasattr(decorator, '__iter__')):
        update_wrapper(_dec, decorator)
    if hasattr(decorator, '__name__'):
        _dec.__name__ = ('method_decorator(%s)' % decorator.__name__)
   ...

What's a good function header?
assistant
#Here's a good function header.

def method_decorator(decorator, name=''):