<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register(self, prefix, viewset, basename, factory=None, permission=None):
 """ Factory and permission are likely only going to exist until I have enough time to write a permissions module for PRF. :param prefix: the uri route prefix. :param viewset: The ViewSet class to route. :param basename: Used to name the route in pyramid. :param factory: Optional, root factory to be used as the context to the route. :param permission: Optional, permission to assign the route. """


        lookup = self.get_lookup(viewset)
        routes = self.get_routes(viewset)

        for route in routes:
            # Only actions which actually exist on the viewset will be bound
            mapping = self.get_method_map(viewset, route.mapping)

            if not mapping:
                continue  # empty viewset

            url = route.url.format(
                prefix=prefix,
                lookup=lookup,
                trailing_slash=self.trailing_slash
            )
            view = viewset.as_view(mapping, **route.initkwargs)
            name = route.name.format(basename=basename)

            if factory:
                self.configurator.add_route(name, url, factory=factory)
            else:
                self.configurator.add_route(name, url)

            self.configurator.add_view(view, route_name=name, permission=permission)