code: def _valid_command_options(
      cmdclass: Mapping = EMPTY,
  ) -> Dict[str, Set[str]]:
      from .._importlib import metadata
      from setuptools.dist import Distribution
  
      valid_options = {
          "global": _normalise_cmd_options(Distribution.global_options)
      }
  
      unloaded_entry_points = metadata.entry_points(
          group="distutils.commands"
      )
      loaded_entry_points = (
          _load_ep(ep) for ep in unloaded_entry_points
      )
      entry_points = (ep for ep in loaded_entry_points if ep)
      for cmd, cmd_class in chain(entry_points, cmdclass.items()):
          opts = valid_options.get(cmd, set())
          opts = opts | _normalise_cmd_options(
              getattr(cmd_class, "user_options", [])
          )
          valid_options[cmd] = opts
  
      return valid_options
  
imports: import logging
  import os
  from collections.abc import Mapping
  from email.headerregistry import Address
  from functools import partial, reduce
  from inspect import cleandoc
  from itertools import chain
  from types import MappingProxyType
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union, cast
  from ..errors import RemovedConfigError
  from ..warnings import SetuptoolsWarning
label_desc: Use image node_id 17 for calling a global function with example usage: _valid_command_options(cmdclass) and returns: valid_options