# Path: gunstar/utils.py
# def import_object(name):
#     """ from tornado.utils.import_object """
#     if name.count('.') == 0:
#         return __import__(name, None, None)
# 
#     parts = name.split('.')
#     obj = __import__('.'.join(parts[:-1]), None, None, [parts[-1]], 0)
#     try:
#         return getattr(obj, parts[-1])
#     except AttributeError:
#         raise ImportError("No module named %s" % parts[-1])


import re
import six
from gunstar.utils import import_object
            token_name, parser = token.split(':')
            if parser == 'int':
                return INT_TOKEN_RE
            elif parser == 'string':
                return STRING_TOKEN_RE
            elif parser == 'slug':
                return SLUG_TOKEN_RE
            elif parser == 'path':
                return PATH_TOKEN_RE
        elif len(token.split(':')) == 3:
            token_name, parser, options = token.split(':')
            if parser == 're':
                return options
        return DEFAULT_TOKEN_RE

    def generate_regex_pattern(self):
        regex_pattern = self.pattern
        token_list = self.get_token_from_pattern()
        for token in token_list:
            regex = self.convert_token_to_regex(token)
            regex_pattern = regex_pattern.replace('{%s}' % token, regex)
        return '^' + regex_pattern + '$'

    def reverse_route(self, *args):
        reversed_pattern = self.pattern
        token_list = self.get_token_from_pattern()
        if len(token_list) != len(args):
            return None
        for i in range(len(token_list)):
            reversed_pattern = reversed_pattern.replace(

# Path: gunstar/utils.py
# def import_object(name):
#     """ from tornado.utils.import_object """
#     if name.count('.') == 0:
#         return __import__(name, None, None)
# 
#     parts = name.split('.')
#     obj = __import__('.'.join(parts[:-1]), None, None, [parts[-1]], 0)
#     try:
#         return getattr(obj, parts[-1])
#     except AttributeError:
#         raise ImportError("No module named %s" % parts[-1])


# Path: gunstar/routing.py
import re
import six
from gunstar.utils import import_object

            token_name, parser = token.split(':')
            if parser == 'int':
                return INT_TOKEN_RE
            elif parser == 'string':
                return STRING_TOKEN_RE
            elif parser == 'slug':
                return SLUG_TOKEN_RE
            elif parser == 'path':
                return PATH_TOKEN_RE
        elif len(token.split(':')) == 3:
            token_name, parser, options = token.split(':')
            if parser == 're':
                return options
        return DEFAULT_TOKEN_RE

    def generate_regex_pattern(self):
        regex_pattern = self.pattern
        token_list = self.get_token_from_pattern()
        for token in token_list:
            regex = self.convert_token_to_regex(token)
            regex_pattern = regex_pattern.replace('{%s}' % token, regex)
        return '^' + regex_pattern + '$'

    def reverse_route(self, *args):
        reversed_pattern = self.pattern
        token_list = self.get_token_from_pattern()
        if len(token_list) != len(args):
            return None
        for i in range(len(token_list)):
            reversed_pattern = reversed_pattern.replace(

                '{%s}' % str(token_list[i]), str(args[i])