def filter_planes(feature_dict, removeDirection, percentile):
    """filter planes by the criteria specified by removeDirection
    and percentile 

    Args:
        feature_dict (dictionary): planes and respective feature value
        removeDirection (string): remove above or below percentile
        percentile (int): cutoff percentile

    Returns:
        set: planes that fit the criteria
    """
    planes = list(feature_dict.keys())
    feat_value = [feature_dict[i] for i in planes]
    thresh = min(feat_value) + percentile * (max(feat_value) - min(feat_value))
    
    # filter planes
    if removeDirection == 'Below':
        keep_planes = [z for z in planes if feature_dict[z] >= thresh]
    else:
        keep_planes = [z for z in planes if feature_dict[z] <= thresh]
    
    return set(keep_planes)