code: def create_cmdclass(
      prerelease_cmd=None, package_data_spec=None, data_files_spec=None
  ):
      """Create a command class with the given optional prerelease class.
  
      Parameters
      ----------
      prerelease_cmd: (name, Command) tuple, optional
          The command to run before releasing.
      package_data_spec: dict, optional
          A dictionary whose keys are the dotted package names and
          whose values are a list of glob patterns.
      data_files_spec: list, optional
          A list of (path, dname, pattern) tuples where the path is the
          `data_files` install path, dname is the source directory, and the
          pattern is a glob pattern.
  
      Notes
      -----
      We use specs so that we can find the files *after* the build
      command has run.
  
      The package data glob patterns should be relative paths from the package
      folder containing the __init__.py file, which is given as the package
      name.
      e.g. `dict(foo=['./bar/*', './baz/**'])`
  
      The data files directories should be absolute paths or relative paths
      from the root directory of the repository.  Data files are specified
      differently from `package_data` because we need a separate path entry
      for each nested folder in `data_files`, and this makes it easier to
      parse.
      e.g. `('share/foo/bar', 'pkgname/bizz, '*')`
      """
      wrapped = [prerelease_cmd] if prerelease_cmd else []
      if package_data_spec or data_files_spec:
          wrapped.append("handle_files")
      wrapper = functools.partial(_wrap_command, wrapped)
      handle_files = _get_file_handler(
          package_data_spec, data_files_spec
      )
  
      if "bdist_egg" in sys.argv:
          egg = wrapper(bdist_egg, strict=True)
      else:
          egg = bdist_egg_disabled
  
      cmdclass = dict(
          build_py=wrapper(build_py, strict=is_repo),
          bdist_egg=egg,
          sdist=wrapper(sdist, strict=True),
          handle_files=handle_files,
      )
  
      if bdist_wheel:
          cmdclass["bdist_wheel"] = wrapper(bdist_wheel, strict=True)
  
      cmdclass["develop"] = wrapper(develop, strict=True)
      return cmdclass
  
imports: from collections import defaultdict
  from os.path import join
  import io
  import os
  import functools
  import pipes
  import re
  import shlex
  import subprocess
  import sys
  from setuptools import Command
  from setuptools.command.build_py import build_py
  from setuptools.command.sdist import sdist
  from distutils import log
  from setuptools.command.develop import develop
  from setuptools.command.bdist_egg import bdist_egg
label_desc: Use image node_id 5 for calling a global function with example usage: create_cmdclass(prerelease_cmd, package_data_spec, data_files_spec) and returns: cmdclass