def flatten_urls(self, urls):
        available_methods = ['POST', 'PUT', 'OPTIONS', 'GET', 'DELETE', 'TRACE', 'COPY']
        ruleset = []
        for route, endpoint in urls.items():
            route_pieces = route.split(' ')
            try:
                methods = url = None
                if len(route_pieces) > 1:
                    methods = [route_pieces[0]]
                    url = route_pieces[1]
                else:
                    methods = available_methods
                    url = route_pieces[0]

                endpoint_pieces = endpoint.split('.')

                if len(endpoint_pieces) > 1:
                    rule = {'url': url, 'endpoint': endpoint, 'methods': methods}
                    ruleset.append(rule)
                else:
                    for method in available_methods:
                        rule = {
                            'url': url,
                            'endpoint': '%s.%s' % (endpoint, method.lower()),
                            'methods': [method]
                        }
                        ruleset.append(rule)
            except Exception as e:
                raise InvalidRouteDefinitionError()
        return ruleset
Function flatten urls for route grouping feature of glim.
dataset/ETHPy150Open aacanakin/glim/glim/app.py/Glim.flatten_urls