from typing import List
from typing import Type


def validate_objects(elements: List, element_class: Type) -> bool:
    """
    Check if all the elements are instance of the element_class.

    Args:
        elements: List of objects that should be instance of element_class.
        element_class: class of the objects.

    Returns:
        True if all the elements are instance of element_class.

    Raises:
        ValueError if one element is not an instance of element_class.

    """
    for element in elements:
        if not isinstance(element, element_class):
            raise ValueError(f"{element} is not a {element_class}")
    return True