def __new__(cls, obj, *args, **kwargs):
    """
        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)
        """
    try:
        cache = cls.__dict__['_class_proxy_cache']
    except KeyError:
        cls._class_proxy_cache = cache = {}
    try:
        theclass = cache[obj.__class__]
    except KeyError:
        cache[obj.__class__] = theclass = cls._create_class_proxy(obj.__class__
            )
    ins = object.__new__(theclass)
    theclass.__init__(ins, obj, *args, **kwargs)
    return ins
