def is_instance_of_union_type(union_type, instance) -> bool:
    """Since it's not possible to runtime check an instance
    against a Union type, this method gets the elements of the union
    and returns true if the instance is of one of those types.
    """
    return any(isinstance(instance, x) for x in union_type.__args__)