code: def _get_collocated(
      cls,
      op: "ToDMatrix",
      data: TileableType,
      label: TileableType,
      weight: TileableType,
      base_margin: TileableType,
  ) -> List[TileableType]:
      types = ["data", "label", "weight", "base_margin"]
      nsplit = data.nsplits[0]
      out_chunkss = [[] for _ in op.inputs]
      for i in range(len(nsplit)):
          data_chunk = data.cix[i, 0]
          inps = [data_chunk]
          kws = []
          chunk_op = op.copy().reset_key()
          chunk_op._collocate = True
          chunk_op.data = data_chunk
          output_types = [get_output_types(data)[0]]
          data_kw = cls._get_kw(data_chunk)
          data_kw["index"] = data_chunk.index
          kws.append(data_kw)
          for type_name, inp in zip(
              types[1:], [label, weight, base_margin]
          ):
              if inp is None:
                  continue
              inp_chunk = inp.cix[i,]
              setattr(chunk_op, type_name, inp_chunk)
              inps.append(inp_chunk)
              kw = cls._get_kw(inp_chunk)
              kw["index"] = inp_chunk.index
              kw["type"] = type_name
              kws.append(kw)
              output_types.append(get_output_types(inp)[0])
          chunk_op.output_types = output_types
          out_chunks = chunk_op.new_chunks(inps, kws=kws)
          for i, out_chunk in enumerate(out_chunks):
              out_chunkss[i].append(out_chunk)
  
      new_op = op.copy()
      new_op._collocate = True
      outs = [data, label, weight, base_margin]
      params = [out.params.copy() for out in outs if out is not None]
      output_types = []
      j = 0
      for i, out in enumerate(outs):
          if out is None:
              continue
          params[j]["nsplits"] = out.nsplits
          params[j]["chunks"] = out_chunkss[j]
          params[j]["type"] = types[i]
          output_types.append(get_output_types(out)[0])
          j += 1
      new_op.output_types = output_types
      return new_op.new_tileables(op.inputs, kws=params)
  
imports: import itertools
  from typing import List, Union
  import numpy
  from ....None import opcodes
  from ....core import get_output_types, recursive_tile
  from ....core.context import get_context, Context
  from ....dataframe.core import DATAFRAME_TYPE
  from ....serialization.serializables import KeyField, Float64Field, ListField, BoolField
  from ....tensor.core import TENSOR_TYPE, TENSOR_CHUNK_TYPE
  from ....tensor import tensor
  from ....typing import TileableType, ChunkType
  from ....utils import has_unknown_shape, ensure_own_data, build_fetch
  from ...operands import LearnOperand, LearnOperandMixin
  from ...utils import convert_to_tensor_or_dataframe, concat_chunks
label_desc: Use image node_id 5 for calling the ToDMatrix obj's underlying member method code with example usage: obj._get_collocated(cls, op, data, label, weight, base_margin) and returns: new_op