def rpcproxy(spec):
    """Decorator to enable this class to proxy RPC client calls

    The decorated class constructor takes two additional arguments,
    `context=` is required to be a :class:`~p4p.client.thread.Context`.
    `format`= can be a string, tuple, or dictionary and is applied
    to PV name strings given to :py:func:`rpcall`.
    Other arguments are passed to the user class constructor. ::

       @rpcproxy
       class MyProxy(object):
           @rpccall("%s:add")
           def add(lhs='d', rhs='d'):
               pass

       ctxt = Context('pva')
       proxy = MyProxy(context=ctxt, format="tst:")  # evaluates "%s:add"%"tst:"

    The decorated class will be a sub-class of the provided class and :class:`RPCProxyBase`.
    """
    # inject our ctor first so we don't have to worry about super() non-sense.

    def _proxyinit(self, context=None, format={}, **kws):
        assert context is not None, context
        self.context = context
        self.format = format
        spec.__init__(self, **kws)
    obj = {'__init__': _proxyinit}

    for K, V in inspect.getmembers(spec, lambda M: hasattr(M, '_call_PV')):
        obj[K] = _wrapMethod(K, V)

    return type(spec.__name__, (RPCProxyBase, spec), obj)