@classmethod
def check_uri(cls, uri):
    """Check URI for validity

        Raises ValueError appropriately
        """
    if len(uri) > cls.MAX_URI_LENGTH:
        raise ValueError('URI exceeds maximum length')
    for char in uri:
        if char not in cls.ALLOWED_URI_CHARS:
            raise ValueError('URI contains invalid character %r' % bytes([
                char]))
