code: def _upsert(array, i, value):
      cp = len(array) - i
  
      if value is None:
          return
  
      if cp == 0:
          array.append(value)
          return
  
      if cp > 0:
          array[i] = value
          return
  
      raise IndexError()
  
imports: from __future__ import annotations
  from copy import deepcopy
  from functools import singledispatch
  from math import log10
  from orion.algo.space import Categorical, Dimension, Fidelity, Integer, Real, Space, SpaceConverter, to_orionspace
label_desc: Use image node_id 2 for calling a global function with example usage: _upsert(array, i, value) without return types