code: def ensure_list(iterable: Iterable[A]) -> List[A]:
      
      if isinstance(iterable, list):
          return iterable
      else:
          return list(iterable)
docs: An Iterable may be a list or a generator.
      This ensures we get a list without making an unnecessary copy.