<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def route(self, path_regex, methods=['GET'], doc=True):
 """ Decorator to register a handler Parameters: * path_regex: Request path regex to match against for running the handler * methods: HTTP methods to use this handler for * doc: Add to internal doc structure """

        def register_func(func):
            """
            Decorator implementation
            """
            if doc:
                self.env['doc'].append({'url': path_regex, 'methods': ', '.join(methods), 'doc': func.__doc__})
            for method in methods:
                self._handlers[method].append((re.compile(path_regex), func))
            return func # Return the original function
        return register_func