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

    """Decorator factory for methods in Magics subclasses.
    """
    validate_type(magic_kind)
    def magic_deco(arg):
        call = (lambda f, *a, **k: f(*a, **k))
        if callable(arg):
            func = arg
            name = func.__name__
            retval = decorator(call, func)
            record_magic(magics, magic_kind, name, name)
        elif isinstance(arg, str):
            name = arg
            def mark(func, *a, **kw):
                record_magic(magics, magic_kind, name, func.__name__)
                return decorator(call, func)
            retval = mark
        else:
            raise TypeError('Decorator    can    only    be    called    with    string    or    function')
        return retval
    magic_deco.__doc__ = _docstring_template.format('method', magic_kind)
    return magic_deco