code: def assign_predictions(pred, p, tei, col, n):
      """Assign predictions to prediction array."""
      if tei == "all":
          tei = None
  
      if tei is None:
          if len(p.shape) == 1:
              pred[:, col] = p
          else:
              pred[:, col : (col + p.shape[1])] = p
      else:
          r = n - pred.shape[0]
  
          if isinstance(tei[0], tuple):
              if len(tei) > 1:
                  idx = np.hstack(
                      [np.arange(t0 - r, t1 - r) for t0, t1 in tei]
                  )
              else:
                  tei = tei[0]
                  idx = slice(tei[0] - r, tei[1] - r)
          else:
              idx = slice(tei[0] - r, tei[1] - r)
  
          if len(p.shape) == 1:
              pred[idx, col] = p
          else:
              pred[(idx, slice(col, col + p.shape[1]))] = p
  
file_path: mlens/mlens/parallel/_base_functions.py
imports: from __future__ import division
  import os
  import warnings
  from scipy.sparse import issparse
  import numpy
  from ..utils import pickle_load, pickle_save, load
  from ..utils.exceptions import MetricWarning, ParameterChangeWarning
label_desc: Use image node_id 9 for calling a global function with example usage: assign_predictions(pred, p, tei, col, n) without return types