class_docstr: Class responsible for handling input data and extracting metadata into the
  appropriate form
class_docstr_tok: ["Class","responsible","for","handling","input","data","and","extracting","metadata","into","the","appropriate","form"]
code: def __setstate__(self, d):
      if "restore_design_info" in d:
          # NOTE: there may be a more performant way to do this
          from patsy import dmatrices, PatsyError
  
          exc = []
          try:
              data = d["frame"]
          except KeyError:
              data = d["orig_endog"].join(d["orig_exog"])
  
          for depth in [
              2,
              3,
              1,
              0,
              4,
          ]:  # sequence is a guess where to likely find it
              try:
                  _, design = dmatrices(
                      d["formula"],
                      data,
                      eval_env=depth,
                      return_type="dataframe",
                  )
                  break
              except (NameError, PatsyError) as e:
                  exc.append(
                      e
                  )  # why do I need a reference from outside except block
                  pass
          else:
              raise exc[-1]
  
          self.design_info = design.design_info
          del d["restore_design_info"]
      self.__dict__.update(d)
  
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 3 for calling the ModelData obj's underlying member method code with example usage: obj.__setstate__(d) without return types