code: def _ensure_tuple_or_list(arg_name, tuple_or_list):
      
      if not isinstance(tuple_or_list, (tuple, list)):
          raise TypeError(
              "Expected %s to be a tuple or list. "
              "Received %r" % (arg_name, tuple_or_list)
          )
      return list(tuple_or_list)
docs: Ensures an input is a tuple or list.
  
      This effectively reduces the iterable types allowed to a very short
      whitelist: list and tuple.
  
      :type arg_name: str
      :param arg_name: Name of argument to use in error message.
  
      :type tuple_or_list: sequence of str
      :param tuple_or_list: Sequence to be verified.
  
      :rtype: list of str
      :returns: The ``tuple_or_list`` passed in cast to a ``list``.
      :raises TypeError: if the ``tuple_or_list`` is not a tuple or list.