code: def enum_factory(QT_API, QtCore):
      """Construct an enum helper to account for PyQt5 <-> PyQt6 changes."""
  
      @lru_cache(None)
      def _enum(name):
          # foo.bar.Enum.Entry (PyQt6) <=> foo.bar.Entry (non-PyQt6).
          return operator.attrgetter(
              name
              if QT_API == QT_API_PYQT6
              else name.rpartition(".")[0]
          )(sys.modules[QtCore.__package__])
  
      return _enum
  
imports: import importlib.abc
  import sys
  import os
  import types
  from functools import partial, lru_cache
  import operator
label_desc: Use image node_id 13 for calling a global function with example usage: enum_factory(QT_API, QtCore) and returns: _enum, operator