def METHOD_NAME(func):
    """Registerize a method, add a `_factory` attribute and a `register`
    interface to a method.
    multiple-level register is automatically supported, users can
    >>> open.register(local_io_adaptor)
    >>> open.register(oss_io_adaptor)
    OR
    >>> open.register('file', local_io_adaptor)
    >>> open.register('odps', odps_io_adaptor)
    OR
    >>> open.register('file', 'csv', local_csv_reader)
    >>> open.register('file', 'tsv', local_tsv_reader)
    """
    @functools.wraps(func)
    def wrap(*args, **kwargs):
        return func(*args, **kwargs)
    setattr(wrap, '_factory', None)
    def register(*args):
        if len(args) == 1:
            if wrap._factory is None:
                wrap._factory = []
            if not isinstance(wrap._factory, list):
                raise RuntimeError(
                    'Invalid arguments: inconsistent with existing registerations'
                )
            wrap._factory.append(args[0])
        else:
            if wrap._factory is None:
                wrap._factory = {}
            if not isinstance(wrap._factory, dict):
                raise RuntimeError(
                    'Invalid arguments: inconsistent with existing registerations'
                )
            root = wrap._factory
            for arg in args[:-2]:
                if arg not in root:
                    root[arg] = dict()
                root = root[arg]
            if args[-2] not in root:
                root[args[-2]] = list()
            root[args[-2]].append(args[-1])
    setattr(wrap, 'register', register)
    return wrap