def to_result(self, iface_name, func_name, resp):
        """
        Takes a JSON-RPC response and checks for an "error" slot. If it exists,
        a RpcException is raised.  If no "error" slot exists, the "result" slot is 
        returned.

        If validate_response==True on the Client constructor, the result is validated
        against the expected return type for the function and a RpcException raised if it is
        invalid.

        :Parameters:
          iface_name
            Interface name that was called
          func_name
            Function that was called on the interface
          resp
            Dict formatted as a JSON-RPC response
        """
        if resp.has_key("error"):
            e = resp["error"]
            data = None
            if e.has_key("data"):
                data = e["data"]
            raise RpcException(e["code"], e["message"], data)
            
        result = resp["result"]
        
        if self.validate_resp:
            self.contract.validate_response(iface_name, func_name, result)
        return result