code: def _ensure_tuple(item):
      
      if isinstance(item, tuple):
          return item
      elif isinstance(item, list):
          return tuple(item)
      elif isinstance(item, np.ndarray):
          return tuple(item.tolist())
      else:
          raise NotImplementedError
docs: Simply ensure that the passed item is a tuple.  If it is not, then
      convert it if possible, or raise a NotImplementedError
  
      Args:
          item: the item that needs to become a tuple
  
      Returns:
          the item casted as a tuple
  
      Raises:
          NotImplementedError: if converting the given item to a tuple
              is not implemented.