code: def _find_service_entries(
      node_role: NodeRole, services: List, modules: List
  ):
      svc_entries_list = []
  
      web_handlers = {}
      for svc_names in services:
          if isinstance(svc_names, str):
              svc_names = [svc_names]
          svc_entries = []
          for svc_name in svc_names:
              svc_mod = None
              for mod_name in modules:
                  try:
                      full_mod_name = f"{mod_name}.{svc_name}.{node_role.name.lower()}"
                      svc_mod = importlib.import_module(full_mod_name)
  
                      abstract_derivatives = []
                      valid_derivatives = []
                      for attr_name in dir(svc_mod):
                          obj = getattr(svc_mod, attr_name)
                          if (
                              obj is not AbstractService
                              and isinstance(obj, type)
                              and issubclass(obj, AbstractService)
                          ):
                              if inspect.isabstract(obj):
                                  abstract_derivatives.append(obj)
                              else:
                                  valid_derivatives.append(obj)
  
                      svc_entries.extend(valid_derivatives)
                      if not valid_derivatives and abstract_derivatives:
                          warnings.warn(
                              f"Module {full_mod_name} does not have non-abstract "
                              f"service classes, but abstract classes "
                              f"{abstract_derivatives} found.",
                              RuntimeWarning,
                          )
  
                      try:
                          web_mod = importlib.import_module(
                              mod_name + "." + svc_name + ".api.web"
                          )
                          web_handlers.update(
                              getattr(web_mod, "web_handlers", {})
                          )
                      except ImportError:
                          pass
                  except ImportError:
                      pass
              if svc_mod is None:
                  raise ImportError(
                      f"Cannot discover {node_role} for service {svc_name}"
                  )
          svc_entries_list.append(svc_entries)
  
      return svc_entries_list, web_handlers
  
file_path: mars/mars/services/core.py
imports: import abc
  import asyncio
  import enum
  import importlib
  import inspect
  import warnings
  from typing import Dict, Iterable, List, Union
label_desc: Use image node_id 1 for calling a global function with example usage: _find_service_entries(node_role, services, modules) and returns: svc_entries_list,  web_handlers