def __new__(cls, obj, *args, **kwargs):
try:<EOL><INDENT>cache = cls.__dict__["<STR_LIT>"]<EOL><DEDENT>except KeyError:<EOL><INDENT>cls._class_proxy_cache = cache = {}<EOL><DEDENT>try:<EOL><INDENT>theclass = cache[obj.__class__]<EOL><DEDENT>except KeyError:<EOL><INDENT>cache[obj.__class__] = theclass = cls._create_class_proxy(obj.__class__)<EOL><DEDENT>ins = object.__new__(theclass)<EOL>theclass.__init__(ins, obj, *args, **kwargs)<EOL>return ins<EOL>
creates an proxy instance referencing `obj`. (obj, *args, **kwargs) are
passed to this class' __init__, so deriving classes can define an
__init__ method of their own.
note: _class_proxy_cache is unique per deriving class (each deriving
class must hold its own cache)