code: def genDMatrix(h2oFrame, xlist, yresp, xgb):
      pandaFtrain = h2oFrame.as_data_frame(use_pandas=True, header=True)
      # need to change column 0 to categorical
      c0 = pd.get_dummies(
          pandaFtrain[yresp], prefix=yresp, drop_first=True
      )
      pandaFtrain.drop([yresp], axis=1, inplace=True)
      pandaF = pd.concat([c0, pandaFtrain], axis=1)
      pandaF.rename(columns={c0.columns[0]: yresp}, inplace=True)
      data = pandaF[xlist].values
      label = pandaF[[yresp]].values
  
      return xgb.DMatrix(data=data, label=label)
  
imports: import pandas
  import sys
  import random
  from h2o.estimators.xgboost import *
  from tests import pyunit_utils
label_desc: Use image node_id 2 for calling a global function with example usage: genDMatrix(h2oFrame, xlist, yresp, xgb) and returns: xgb