Raise an exception if the authority is not a valid ENS domain
    or a valid checksummed contract address.
518304
def validate_registry_uri_authority(auth: str) -> None:
    
    if is_ens_domain(auth) is False and not is_checksum_address(auth):
        raise ValidationError(f"{auth} is not a valid registry URI authority.")
568007
def validate_cmd_response_nonce(got, used):
    
    if used == '000000000000'.decode('hex'):
        if got == used:
            raise(pyhsm.exception.YHSM_Error("Bad nonce in response (got %s, expected HSM generated nonce)" \
                                                 % (got.encode('hex'))))
        return got
    return validate_cmd_response_str('nonce', got, used)
311455
def _assert_valid_permission(self, perm_str):
        """"""
        if perm_str not in ORDERED_PERM_LIST:
            raise d1_common.types.exceptions.InvalidRequest(
                0,
                'Permission must be one of {}. perm_str="{}"'.format(
                    ', '.join(ORDERED_PERM_LIST), perm_str
                ),
            )
366914
def assert_valid_name(name: str) -> str:
    """"""
    error = is_valid_name_error(name)
    if error:
        raise error
    return name
719760
def _check_checksum(msg):
    """"""
    checksum = int(msg[-2:], 16)
    for char in msg[:-2]:
        checksum += ord(char)
    if (checksum % 256) != 0:
        raise ValueError("Elk message checksum invalid")
492635
def in6_isvalid(address):
    """"""

    try:
        socket.inet_pton(socket.AF_INET6, address)
        return True
    except Exception:
        return False
5345
def validate(self, value):
        
        if '.' not in value:
            self.error_message = '%s is not a fully qualified domain name.' % \
                                 value
            return False
        try:
            ipaddress = socket.gethostbyname(value)
        except socket.gaierror:
            self.error_message = '%s does not resolve.' % value
            return False
        try:
            socket.gethostbyaddr(ipaddress)
        except socket.herror:
            self.error_message = \
                '%s reverse address (%s) does not resolve.' % \
                (value, ipaddress)
            return False
        self._choice = value
        return True
979919
def isValidPublicAddress(address: str) -> bool:
    """"""
    valid = False

    if len(address) == 34 and address[0] == 'A':
        try:
            base58.b58decode_check(address.encode())
            valid = True
        except ValueError:
            # checksum mismatch
            valid = False

    return valid
235265
def expect_invalid_resp_data(data=''):
    """"""
    try:
        yield
    except (ValueError, TypeError, IndexError, AttributeError,
            KeyError) as err:
        msg = ('Invalid smt response data: %s. Error: %s' %
               (data, six.text_type(err)))
        LOG.error(msg)
        raise exception.SDKInternalError(msg=msg)
809558
def handle_error(self, env):
        '''
        '''
        logger.exception('Exception for %s %s :',
                         env.request.method, env.request.url)
115986
def raise_ssl_error(code, nested=None):
    """"""
    err_string = str(code) + ": " + _ssl_errors[code]
    if nested:
        raise SSLError(code, err_string + str(nested))
    raise SSLError(code, err_string)
145494
def validate_or_raise(self, *a, **k):
        
        
        validate, err = self.validate(*a, **k)
        
        if err:
            raise ValidationException(err)
        
        return validate
1177906
def validate_bitcoin_change_address!
      addr = self.bitcoin_change_address
      raise ArgumentError, "Missing bitcoin_change_address" if !addr
      raise ArgumentError, "bitcoin_change_address must be an instance of BTC::Address" if !addr.is_a?(Address)
      raise ArgumentError, "bitcoin_change_address must not be an instance of BTC::AssetAddress" if addr.is_a?(AssetAddress)
    end
1080135
def _validate_authority_uri_abs_path(host, path):
        
        if len(host) > 0 and len(path) > 0 and not path.startswith("/"):
            raise ValueError(
                "Path in a URL with authority " "should start with a slash ('/') if set"
            )
818167
def assert_valid(self):
        """"""

        for ns_uri, ni in six.iteritems(self.__ns_uri_map):
            if not ni.uri:
                raise InvalidNamespaceSetError(
                    "URI not set in _NamespaceInfo (id={0}):\n{1}".format(
                        id(ni), ni
                    )
                )

            if ns_uri != ni.uri:
                raise InvalidNamespaceSetError(
                    "URI mismatch in dict ({0}) and _NamespaceInfo ({1})".format(
                        ns_uri, ni.uri
                    )
                )

            if (ni.preferred_prefix is not None and
               ni.preferred_prefix not in ni.prefixes):
                raise InvalidNamespaceSetError(
                    "Namespace {0.uri}: preferred prefix " \
                    '"{0.preferred_prefix}" not in prefixes ' \
                    "{0.prefixes}".format(ni)
                )

            for prefix in ni.prefixes:
                if not prefix:
                    raise InvalidNamespaceSetError(
                        "Namespace {0.uri}: empty value in prefix " \
                        "set: {0.prefixes}".format(ni)
                    )
                other_ni = self.__prefix_map.get(prefix)
                if other_ni is None:
                    raise InvalidNamespaceSetError(
                        'Namespace {0.uri}: prefix "{1}" not in ' \
                        'prefix map'.format(ni, prefix)
                    )
                if other_ni is not ni:
                    raise InvalidNamespaceSetError(
                        'Namespace {0.uri}: prefix "{1}" maps to ' \
                        'wrong _NamespaceInfo (id={2}, uri={3.uri})'.format(
                            ni, prefix, id(other_ni), other_ni
                        )
                    )

        if None in self.__prefix_map:
            # None can be a preferred prefix, but should not be in the
            # prefix map.
            raise InvalidNamespaceSetError("None is in prefix map!")
262757
def validate(self):
		
		if self.implemented_protocol_version != self.protocol_version:
			raise OmapiError("protocol mismatch")
		if self.implemented_header_size != self.header_size:
			raise OmapiError("header size mismatch")
558562
def validate(self):
        
        if not self.principals:
            raise InvalidApplicationPolicyError(error_message='principals not provided')

        if not self.actions:
            raise InvalidApplicationPolicyError(error_message='actions not provided')

        if any(not self._PRINCIPAL_PATTERN.match(p) for p in self.principals):
            raise InvalidApplicationPolicyError(
                error_message='principal should be 12-digit AWS account ID or "*"')

        unsupported_actions = sorted(set(self.actions) - set(self.SUPPORTED_ACTIONS))
        if unsupported_actions:
            raise InvalidApplicationPolicyError(
                error_message='{} not supported'.format(', '.join(unsupported_actions)))

        return True