code: def get_routes(self, viewset):
          
  
          known_actions = list(flatten([route.mapping.values() for route in self.routes if isinstance(route, Route)]))
  
          # Determine any `@detail_route` or `@list_route` decorated methods on the viewset
          detail_routes = []
          list_routes = []
  
          for methodname in dir(viewset):
              attr = getattr(viewset, methodname)
              httpmethods = getattr(attr, 'bind_to_methods', None)
              detail = getattr(attr, 'detail', True)
  
              if httpmethods:
                  # check against know actions list
                  if methodname in known_actions:
                      raise ImproperlyConfigured('Cannot use @detail_route or @list_route '
                                                 'decorators on method "%s" '
                                                 'as it is an existing route'.format(methodname))
  
                  httpmethods = [method.lower() for method in httpmethods]
  
                  if detail:
                      detail_routes.append((httpmethods, methodname))
                  else:
                      list_routes.append((httpmethods, methodname))
  
          def _get_dynamic_routes(route, dynamic_routes):
              ret = []
  
              for httpmethods, methodname in dynamic_routes:
                  method_kwargs = getattr(viewset, methodname).kwargs
                  initkwargs = route.initkwargs.copy()
                  initkwargs.update(method_kwargs)
                  url_path = initkwargs.pop("url_path", None) or methodname
  
                  ret.append(Route(
                      url=replace_methodname(route.url, url_path),
                      mapping={httpmethod: methodname for httpmethod in httpmethods},
                      name=replace_methodname(route.name, url_path),
                      initkwargs=initkwargs,
                  ))
  
              return ret
  
          ret = []
  
          for route in self.routes:
              if isinstance(route, DynamicDetailRoute):
                  # Dynamic detail routes (@detail_route decorator)
                  ret += _get_dynamic_routes(route, detail_routes)
              elif isinstance(route, DynamicListRoute):
                  # Dynamic list routes (@list_route decorator)
                  ret += _get_dynamic_routes(route, list_routes)
              else:
                  # Standard route
                  ret.append(route)
  
          return ret
docs: Augment `self.routes` with any dynamically generated routes.
          Returns a list of the Route namedtuple.