def _compile_route(self, route):
        """returns a compiled regular expression"""
        # chop off leading slash
        if route.startswith('/'):
            route = route[1:]
        
        trailing_slash = False
        # check end slash and remember to keep it
        if route.endswith('/'):
            route = route[:-1]
            trailing_slash = True
        
        # split into path components
        bits = route.split('/')
    
        # compiled match starts with a slash,
        #  so we make it a list so we can join later
        regex = ['']
        for path_component in bits:
            if path_component.startswith(':'):
                # it's a route, so compile
                name = path_component[1:]
                # accept only valid URL characters
                regex.append(name % r'(?P<%s>[-_a-zA-Z0-9+%%]+)')
            else:
                # just a string/static path component
                regex.append(path_component)
            
        # stick the trailing slash back on
        if trailing_slash:
            regex.append('')
        
        # stitch it back together as a path
        return '^%s$' % '/'.join(regex)
dataset/ETHPy150Open bradwright/mnml/mnml.py/UrlRouting._compile_route/swapped operands of `%`