code: def handle_data_class_factory(endog, exog):
      """
      Given inputs
      """
      if data_util._is_using_ndarray_type(endog, exog):
          klass = ModelData
      elif data_util._is_using_pandas(endog, exog):
          klass = PandasData
      elif data_util._is_using_patsy(endog, exog):
          klass = PatsyData
      # keep this check last
      elif data_util._is_using_ndarray(endog, exog):
          klass = ModelData
      else:
          raise ValueError(
              "unrecognized data structures: %s / %s"
              % (type(endog), type(exog))
          )
      return klass
  
imports: from __future__ import annotations
  from statsmodels.compat.python import lmap
  from functools import reduce
  import numpy
  from pandas import DataFrame, Series, isnull, MultiIndex
  import statsmodels.tools.data
  from statsmodels.tools.decorators import cache_readonly, cache_writable
  from statsmodels.tools.sm_exceptions import MissingDataError
label_desc: Use image node_id 7 for calling a global function with example usage: handle_data_class_factory(endog, exog) and returns: klass