'Return a (target, url_agrs) tuple or raise HTTPError(404/405).'

def match(self, environ):

    (targets, urlargs) = self._match_path(environ)
    if (not targets):
        raise HTTPError(404, ('Not    found:    ' + repr(environ['PATH_INFO'])))
    method = environ['REQUEST_METHOD'].upper()
    if (method in targets):
        return (targets[method], urlargs)
    if ((method == 'HEAD') and ('GET' in targets)):
        return (targets['GET'], urlargs)
    if ('ANY' in targets):
        return (targets['ANY'], urlargs)
    allowed = [verb for verb in targets if (verb != 'ANY')]
    if (('GET' in allowed) and ('HEAD' not in allowed)):
        allowed.append('HEAD')
    raise HTTPError(405, 'Method    not    allowed.', header=[('Allow', ','.join(allowed))])
