def check_or_raise_uri(value, message):
    if (type(value) != six.text_type):
        raise ProtocolError('{0}: invalid type {1} for URI'.format(message, type(value)))
    if (not _URI_PAT_LOOSE.match(value)):
        raise ProtocolError("{0}: invalid value '{1}' for URI".format(message, value))
    return value
def check_or_raise_uri(value, message):
    if (type(value) != six.text_type):
        raise ProtocolError('{0}: invalid type {1} for URI'.format(message, type(value)))
    if (not _URI_PAT_LOOSE.match(value)):
        raise ProtocolError("{0}: invalid value '{1}' for URI".format(message, value))
    return value