code: def get_handlers(server, modules: list[str], prefix="/"):  # type: ignore[no-untyped-def]
      prefix = prefix or ""
      prefix = "/" + prefix.strip("/")
  
      if not prefix.endswith("/"):
          prefix = prefix + "/"
  
      _routes = []
      for module_name in modules:
          module = importlib.import_module(module_name)
          _routes.extend(module.routes)
  
      routes = []
  
      for url, cls, kwargs in _routes:
          if has_keyword(cls.initialize, "dask_server"):
              kwargs = toolz.assoc(kwargs, "dask_server", server)
  
          routes.append((prefix + url.lstrip("/"), cls, kwargs))
  
      return routes
  
file_path: distributed/distributed/http/utils.py
imports: from __future__ import annotations
  import importlib
  import os
  import toolz
  from tornado import web
  from distributed.utils import has_keyword
label_desc: Use image node_id 2 for calling a global function with example usage: get_handlers(server, modules, prefix) and returns: routes