def METHOD_NAME(type_to_validate, accepted_types):
    # Check if the provided type is accepted
    if (type_to_validate is not None) and (not isinstance(type_to_validate, accepted_types)):
        raise TypeError(
            "type_to_validate should be None, type or str. {} provided".format(type(type_to_validate))
        )
    if isinstance(type_to_validate, str):
        type_to_validate = type_to_validate.lower()
        if type_to_validate in KNOWN_TYPES.keys():
            type_to_validate = KNOWN_TYPES[type_to_validate]
        else:
            raise TypeError(
                "type_to_validate is not a known type. Known types are :"
                " \n{}\n Provided : \n{}".format(KNOWN_TYPES.keys(), type_to_validate)
            )
    return type_to_validate