from typing import Iterable
from typing import Any


def _all_instance_of(collection: Iterable, cls: Any) -> bool:
  """Returns true if all elements of the iterable is an instance of cls."""
  return all(isinstance(e, cls) for e in collection)