Function creates instances of controllers, adds into bottle routes

def register_routes(self):
        """
        Function creates instances of controllers, adds into bottle routes
        """
        routes = self.flatten_urls(self.urls)
        self.controllers = {}
        controller_names = set()

        for route in routes:
            cname = route['endpoint'].split('.')[0]
            controller_names.add(cname)

        for cname in controller_names:
            attr = getattr(self.mcontrollers, cname)
            instance = attr(request, response)
            self.controllers[cname] = instance

        for route in routes:
            cname, aname = route['endpoint'].split('.')
            action = getattr(self.controllers[cname], aname)
            self.wsgi.route(route['url'], route['methods'], action)