'Find the correct handler method given the path info from the HTTP request.'

def match_pattern(self, pattern_handlers):

    path = urlparse.urlparse(self.path).path
    for (pattern, handler) in pattern_handlers.items():
        match = re.match(pattern, path)
        if match:
            handler(*match.groups())
            return True
