def _custom_inherit(baseclass, delegator='<STR_LIT>', include=None, exclude=None):
<EOL>if not isinstance(include, set):<EOL><INDENT>include = set(include) if include else set()<EOL><DEDENT>if not isinstance(exclude, set):<EOL><INDENT>exclude = set(exclude) if exclude else set()<EOL><DEDENT>delegated_attrs = set()<EOL>attributes = include | delegated_attrs - exclude<EOL>def wrapper(subclass):<EOL><INDENT>attrs = attributes - set(subclass.__dict__.keys())<EOL>for attr in attrs:<EOL><INDENT>setattr(subclass, attr, _DelegatedAttribute(delegator, attr, baseclass))<EOL><DEDENT>return subclass<EOL><DEDENT>return wrapper<EOL>
A decorator to customize inheritance of the decorated class from the
    given baseclass. `delegator` is the name of the attribute on the subclass
    through which delegation is done;  `include` and `exclude` are a whitelist
    and blacklist of attrs to include from baseclass.__dict__, providing the
    main customization hooks.