code: def randchoice(seq: Union[str, list, tuple, dict, set]) -> any:
      
      if not isinstance(seq, (str, list, tuple, dict, set)):
          raise TypeError('seq must be str, list, tuple, dict or set')
      if len(seq) <= 0:
          raise IndexError('seq must have at least one element')
  
      if isinstance(seq, set):
          values = list(seq)
          return randchoice(values)
      elif isinstance(seq, dict):
          indexes = list(seq)
          index = randchoice(indexes)
      else:
          index = randbelow(len(seq))
  
      return seq[index]
docs: Return a randomly chosen element from the given sequence.
  
      Raises TypeError if *seq* is not str, list, tuple, dict, set and an
      IndexError if it is empty.
  
      >>> randchoice((1, 2, 'a', 'b'))  #doctest:+SKIP
      'a'