'Initializes the maps needed for mapping urls to handlers and handlers
to urls.
Args:
handler_tuples: list of (URI, RequestHandler) pairs.'

def _init_url_mappings(self, handler_tuples):

    handler_map = {}
    pattern_map = {}
    url_mapping = []
    for (regexp, handler) in handler_tuples:
        try:
            handler_name = handler.__name__
        except AttributeError:
            pass
        else:
            handler_map[handler_name] = handler
        if (not regexp.startswith('^')):
            regexp = ('^' + regexp)
        if (not regexp.endswith('$')):
            regexp += '$'
        if (regexp == '^/form$'):
            logging.warning('The    URL    "/form"    is    reserved    and    will    not    be    matched.')
        compiled = re.compile(regexp)
        url_mapping.append((compiled, handler))
        num_groups = len(RE_FIND_GROUPS.findall(regexp))
        handler_patterns = pattern_map.setdefault(handler, [])
        handler_patterns.append((compiled, num_groups))
    self._handler_map = handler_map
    self._pattern_map = pattern_map
    self._url_mapping = url_mapping
