code: def delist(values):
      
      assert isinstance(values, list)
  
      if not values:
          return None
      elif len(values) == 1:
          return values[0]
  
      return values
docs: Reduce lists of zero or one elements to individual values.