def least_distance_only(annotation, new_annotations):
    """Condition function to keep only smallest distance annotation per image

    Args:
        annotation: Current annotation being examined
        new_annotations: Dict of new annotations kept by image_name

    Returns: True if annotation image is not yet in new_annotations or distance
             is less than previous value. False otherwise.
    """

    image_name = annotation["image_name"]
    if image_name in new_annotations:

        return annotation["distance"] < new_annotations[image_name]["distance"]
    else:

        return True