Compiles a list of match functions (using regular expressions) for
        the paths. Returns a list of two-item tuples consisting of the match
        function and the resource class. The list is in the same order as the
        resources parameter.

        :param resources: List of :class:`wsgiservice.resource.Resource`
                          classes to be served by this application.

def _compile(self, resources):
        """Compiles a list of match functions (using regular expressions) for
        the paths. Returns a list of two-item tuples consisting of the match
        function and the resource class. The list is in the same order as the
        resources parameter.

        :param resources: List of :class:`wsgiservice.resource.Resource`
                          classes to be served by this application.
        """
        routes = []
        search_vars = re.compile(r'\{(\w+)\}').finditer
        for resource in resources:
            # Compile regular expression for each path
            path, regexp, prev_pos = resource._path, '^', 0
            for match in search_vars(path):
                regexp += re.escape(path[prev_pos:match.start()])
                # .+? - match any character but non-greedy
                regexp += '(?P<{0}>.+?)'.format(match.group(1))
                prev_pos = match.end()
            regexp += re.escape(path[prev_pos:])
            # Allow an extension to overwrite the mime type
            extensions = "|".join([ext for ext, _ in resource.EXTENSION_MAP])
            regexp += '(?P<_extension>' + extensions + ')?$'
            routes.append((re.compile(regexp).match, resource))
        return routes