code: def take_one(ls: Union[Sequence, Mapping, Set]) -> Any:
      """Extract element from a collection containing just one element.
  
      Args:
          ls (Union[Sequence, Mapping]): collection containing one element.
  
      Returns:
          Element extracted from collection.
  
      """
      if not len(ls) == 1:
          raise IndexError(f"has more than one element ({len(ls)})")
      return next(iter(ls))
  
imports: import math
  import itertools
  from dataclasses import replace
  from typing import Mapping, Any, Sequence, Iterable, Iterator, Union, Tuple, Dict, Set
label_desc: Use image node_id 1 for calling a global function with example usage: take_one(ls) and returns: next