def generic_setter(value, class_):
    """Generic setter for class objects

        Args:
            value: The value to be validated.
            class_: The class to validate with

        Raises:
            TypeError: If the value is not an instance of the class
    """
    if isinstance(value, class_) or value is None:
        return value

    raise TypeError(f"The value has to be an instance of the "
                    f"{class_.__name__} class. {type(value)} passed")