code: def check_extend(res1, res2, endog_M2, endog_Q2):
      # res1 is the usual results object
      # endog_M2 is the monthly data to append
      # endog_Q2 is the, optional, quarterly data to append
      # res2 is an optional "manually standardized" results object
  
      # Test for extending to the usual results object
      res1_extend = res1.extend(endog_M2, endog_quarterly=endog_Q2)
      mod1_extend = res1_extend.model
      mod1 = res1.model
  
      # Check that the models are the same
      check_identical_models(mod1, mod1_extend, check_nobs=False)
      assert_equal(mod1_extend.nobs, len(endog_M2))
  
      # Test that "manual standardization" continues to work with extend
      res2_extend = res2.extend(endog_M2, endog_quarterly=endog_Q2)
      mod2_extend = res2_extend.model
      mod2 = res2.model
  
      # Because our mod2 has manual changes, we need to copy those over and
      # re-create the extended results object
      mod2_extend.update(res2_extend.params)
      mod2_extend["obs_intercept"] = mod2["obs_intercept"]
      mod2_extend["design"] = mod2["design"]
      mod2_extend["obs_cov"] = mod2["obs_cov"]
      mod2_extend.update = lambda params, **kwargs: params
      res2_extend = mod2_extend.smooth(res2_extend.params)
  
      # Check that the models are the same
      check_identical_models(mod2, mod2_extend, check_nobs=False)
  
      # Check res1_extend vs res2_extend
      check_standardized_results(
          res1_extend, res2_extend, check_diagnostics=False
      )
  
imports: from statsmodels.compat.pandas import MONTH_END, QUARTER_END, assert_frame_equal, assert_series_equal
  import numpy
  from numpy.testing import assert_, assert_allclose, assert_equal
  import pandas
  import pytest
  from statsmodels.regression.linear_model import OLS
  from statsmodels.tools import add_constant
  from statsmodels.tsa.statespace import dynamic_factor, dynamic_factor_mq, sarimax
  from statsmodels.tsa.statespace.tests import test_dynamic_factor_mq_monte_carlo
label_desc: Use image node_id 24 for calling a global function with example usage: check_extend(res1, res2, endog_M2, endog_Q2) without return types