code: def unpack_singleton(x: OptionalList[T]) -> OptionalList[T]:
      """Gets the first element of a list if it has only one value.
  
      Otherwise return the list.
  
      # Argument
          x: A list or singleton.
  
      # Returns
          The same list or the first element.
      """
      if isinstance(x, list) and len(x) == 1:
          return x[0]
      return x
  
imports: from __future__ import annotations
  from typing import TypeVar
  import numpy
  import tensorflow
  import tensorflow.keras.backend
  from innvestigate.backend.types import Layer, OptionalList, ShapeTuple, Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: unpack_singleton(x) and returns: x, x