code: def _to_size(size, side_index: int) -> float:
      if size is None:
          return None
  
      if isinstance(size, float):
          return size
  
      if not (isinstance(size, list) or isinstance(size, tuple)):
          raise TypeError(
              "Invalid 'size' type: {}. Expected: float, list or tuple.".format(
                  type(size)
              )
          )
  
      try:
          return size[side_index]
      except IndexError:
          return None
  
imports: from .core import FeatureSpec, LayerSpec, DummySpec, FeatureSpecArray
label_desc: Use image node_id 2 for calling a global function with example usage: _to_size(size, side_index) and returns: None, size, size, None