def validate_response(self, resp):
        """
        Validates resp against expected return type for this function.  
        Raises RpcException if the response is invalid.
        """
        ok, msg = self.contract.validate(self.returns, 
                                         self.returns.is_array, resp)
        if not ok:
            vals = (self.full_name, str(resp), msg)
            msg = "Function '%s' invalid response: '%s'. %s" % vals
            raise RpcException(ERR_INVALID_RESP, msg)