<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def verify_uri(endpoint_context, request, uri_type, client_id=None):
 """ A redirect URI MUST NOT contain a fragment MAY contain query component :param endpoint_context: :param request: :param uri_type: redirect_uri/post_logout_redirect_uri :return: An error response if the redirect URI is faulty otherwise None """

    try:
        _cid = request["client_id"]
    except KeyError:
        _cid = client_id

    if not _cid:
        logger.error('No client id found')
        raise UnknownClient('No client_id provided')

    _redirect_uri = unquote(request[uri_type])

    part = urlparse(_redirect_uri)
    if part.fragment:
        raise URIError("Contains fragment")

    (_base, _query) = splitquery(_redirect_uri)
    if _query:
        _query = parse_qs(_query)

    match = False
    try:
        values = endpoint_context.cdb[_cid]['{}s'.format(uri_type)]
    except KeyError:
        raise ValueError('No registered {}'.format(uri_type))
    else:
        for regbase, rquery in values:
            # The URI MUST exactly match one of the Redirection URI
            if _base == regbase:
                # every registered query component must exist in the uri
                if rquery:
                    if not _query:
                        raise ValueError('Missing query part')

                    for key, vals in rquery.items():
                        if key not in _query:
                            raise ValueError('"{}" not in query part'.format(key))

                        for val in vals:
                            if val not in _query[key]:
                                raise ValueError('{}={} value not in query part'.format(key, val))

                # and vice versa, every query component in the uri
                # must be registered
                if _query:
                    if not rquery:
                        raise ValueError('No registered query part')

                    for key, vals in _query.items():
                        if key not in rquery:
                            raise ValueError('"{}" extra in query part'.format(key))
                        for val in vals:
                            if val not in rquery[key]:
                                raise ValueError('Extra {}={} value in query part'.format(key, val))
                match = True
                break
        if not match:
            raise RedirectURIError("Doesn't match any registered uris")