def create_cifar_filter_func(classes, get_val):
    """Create filter function that takes in the class label and filters if it
    is not one of classes. If get_val is True, subtracts 50 from class label
    first (since validation for CIFAR-50 is done on last 50 classes).
    """
    if get_val:
        return lambda x: (x - 50) in classes
    else:
        return lambda x: x in classes