Function flatten urls for route grouping feature of glim.

        Args
        ----
          urls (dict): a dict of url definitions.
          current_key (unknown type): a dict or a string marking the
            current key that is used for recursive calls.
          ruleset (dict): the ruleset that is eventually returned to
            dispatcher.

        Returns
        -------
          ruleset (list): a list of ruleset dict with endpoint, url and method functions

def flatten_urls(self, urls):
        """
        Function flatten urls for route grouping feature of glim.

        Args
        ----
          urls (dict): a dict of url definitions.
          current_key (unknown type): a dict or a string marking the
            current key that is used for recursive calls.
          ruleset (dict): the ruleset that is eventually returned to
            dispatcher.

        Returns
        -------
          ruleset (list): a list of ruleset dict with endpoint, url and method functions
        """
        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