'Try to call a method of the referrent and return a copy of the result'

def _callmethod(self, methodname, args=(), kwds={}):

    try:
        conn = self._tls.connection
    except AttributeError:
        util.debug('thread    %r    does    not    own    a    connection', threading.current_thread().name)
        self._connect()
        conn = self._tls.connection
    conn.send((self._id, methodname, args, kwds))
    (kind, result) = conn.recv()
    if (kind == '#RETURN'):
        return result
    elif (kind == '#PROXY'):
        (exposed, token) = result
        proxytype = self._manager._registry[token.typeid][(-1)]
        token.address = self._token.address
        proxy = proxytype(token, self._serializer, manager=self._manager, authkey=self._authkey, exposed=exposed)
        conn = self._Client(token.address, authkey=self._authkey)
        dispatch(conn, None, 'decref', (token.id,))
        return proxy
    raise convert_to_error(kind, result)
