def METHOD_NAME(transformation, transformation_classes):
    """Determines if ``transformation`` is or consists only of instances of a
    class in ``transformation_classes``"""
    from textattack.transformations import CompositeTransformation
    if isinstance(transformation, CompositeTransformation):
        for t in transformation.transformations:
            if not METHOD_NAME(t, transformation_classes):
                return False
        return True
    else:
        for transformation_class in transformation_classes:
            if isinstance(transformation, transformation_class):
                return True
        return False