def proxy_methods(base, include_underscore=None, exclude=None, supers=True):
always_exclude = ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>')<EOL>if isinstance(include_underscore, str):<EOL><INDENT>include_underscore = (include_underscore,)<EOL><DEDENT>if isinstance(exclude, str):<EOL><INDENT>exclude = (exclude,)<EOL><DEDENT>if not include_underscore:<EOL><INDENT>include_underscore = ()<EOL><DEDENT>if not exclude:<EOL><INDENT>exclude = ()<EOL><DEDENT>def rebuild_class(cls):<EOL><INDENT>bases_other = list(cls.__bases__)<EOL>if bases_other[-<NUM_LIT:1>] is object:<EOL><INDENT>bases_other.pop()<EOL><DEDENT>if base in bases_other:<EOL><INDENT>bases_other = bases_other[:bases_other.index(base)]<EOL><DEDENT>if not issubclass(cls.__bases__[<NUM_LIT:0>], Remote):<EOL><INDENT>raise DistobTypeError('<STR_LIT>')<EOL><DEDENT>if not issubclass(base, object):<EOL><INDENT>raise DistobTypeError('<STR_LIT>')<EOL><DEDENT>dct = cls.__dict__.copy()<EOL>if cls.__doc__ is None or '<STR_LIT:\n>' not in cls.__doc__:<EOL><INDENT>base_doc = base.__doc__<EOL>if base_doc is None:<EOL><INDENT>base_doc = '<STR_LIT>'<EOL><DEDENT>dct['<STR_LIT>'] = """<STR_LIT>""" % ((base.__name__,)*<NUM_LIT:3>) + base_doc<EOL><DEDENT>newcls = type(cls.__name__, cls.__bases__, dct)<EOL>newcls._include_underscore = include_underscore<EOL>newcls._exclude = exclude<EOL>if supers:<EOL><INDENT>proxied_classes = base.__mro__[:-<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>proxied_classes = (base,)<EOL><DEDENT>for c in proxied_classes:<EOL><INDENT>for name in c.__dict__:<EOL><INDENT>if (name not in newcls.__dict__ and<EOL>all(name not in b.__dict__ <EOL>for c in bases_other for b in c.mro()[:-<NUM_LIT:1>]) and<EOL>name not in newcls._exclude and<EOL>name not in always_exclude and<EOL>(name[<NUM_LIT:0>] != '<STR_LIT:_>' or <EOL>newcls._include_underscore is True or<EOL>name in newcls._include_underscore)):<EOL><INDENT>f = c.__dict__[name]<EOL>if hasattr(f, '<STR_LIT>'):<EOL><INDENT>doc = f.__doc__<EOL><DEDENT>else:<EOL><INDENT>doc = None<EOL><DEDENT>if callable(f) and not isinstance(f, type):<EOL><INDENT>setattr(newcls, name, _make_proxy_method(name, doc))<EOL><DEDENT>else:<EOL><INDENT>setattr(newcls, name, _make_proxy_property(name, doc))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>newcls.__module__ = '<STR_LIT:__main__>' <EOL>import __main__<EOL>__main__.__dict__[newcls.__name__] = newcls <EOL>ObjectHub.register_proxy_type(base, newcls)<EOL>return newcls<EOL><DEDENT>return rebuild_class<EOL>
class decorator. Modifies `Remote` subclasses to add proxy methods and
    attributes that mimic those defined in class `base`.

    Example:

      @proxy_methods(Tree)
      class RemoteTree(Remote, Tree)

    The decorator registers the new proxy class and specifies which methods
    and attributes of class `base` should be proxied via a remote call to
    a real object, and which methods/attributes should not be proxied but
    instead called directly on the instance of the proxy class.

    By default all methods and attributes of the class `base` will be
    proxied except those starting with an underscore.

    The MRO of the decorated class is respected:
    Any methods and attributes defined in the decorated class
    (or in other bases of the decorated class that do not come after `base`
     in its MRO) will override those added by this decorator,
    so that `base` is treated like a base class.

    Args:
      base (type): The class whose instances should be remotely controlled.
      include_underscore (bool or sequence of str): Should methods or
        attributes that start with an underscore be proxied anyway? If a
        sequence of names is provided then methods or attributes starting with
        an underscore will only be proxied if their names are in the sequence.
      exclude (sequence of str): Names of any methods or attributes that 
        should not be proxied.
      supers (bool): Proxy methods and attributes defined in superclasses 
        of ``base``, in addition to those defined directly in class ``base``