from typing import Type


def _generate_type_error(actual_type: Type, expected_type: Type) -> TypeError:
    message = f"Expected type {expected_type}, got {actual_type}."
    return TypeError(message)
