code: def _data_gen(endog, exog, partitions):
      """partitions data"""
  
      n_exog = exog.shape[0]
      n_part = np.ceil(n_exog / partitions)
  
      n_part = np.floor(n_exog / partitions)
      rem = n_exog - n_part * partitions
  
      stp = 0
  
      while stp < (partitions - 1):
          ii = int(n_part * stp)
          jj = int(n_part * (stp + 1))
          yield endog[ii:jj], exog[ii:jj, :]
          stp += 1
  
      ii = int(n_part * stp)
      jj = int(n_part * (stp + 1) + rem)
      yield endog[ii:jj], exog[ii:jj, :]
  
imports: import numpy
  from numpy.testing import assert_equal, assert_, assert_allclose
  from statsmodels.regression.linear_model import OLS
  from statsmodels.genmod.generalized_linear_model import GLM
  from statsmodels.genmod.families import Binomial
  from statsmodels.base.distributed_estimation import _calc_grad, _calc_wdesign_mat, _est_regularized_debiased, _join_debiased, _est_regularized_naive, _est_unregularized_naive, _join_naive, DistributedModel
label_desc: Use image node_id 1 for calling a global function with example usage: _data_gen(endog, exog, partitions) without return types