def METHOD_NAME(
    ibs,
    delete_empty_names=False,
    delete_empty_imagesets=False,
    delete_annotations_for_missing_images=False,
    delete_image_labels_for_missing_types=False,
    delete_annot_labels_for_missing_types=False,
    delete_chips_for_missing_annotations=False,
    delete_features_for_missing_annotations=False,
    delete_invalid_eg_relations=False,
    delete_invalid_gl_relations=False,
    delete_invalid_al_relations=True,
):
    # ZERO ORDER
    if delete_empty_names:
        ibs.delete_empty_nids()
    if delete_empty_imagesets:
        ibs.delete_empty_imgsetids()
    # FIRST ORDER
    if delete_annotations_for_missing_images:
        ibs.db.executeone(
            """
            DELETE
            FROM {ANNOTATION_TABLE}
            WHERE
                image_rowid NOT IN (SELECT rowid FROM {IMAGE_TABLE})
            """.format(
                **const.__dict__
            )
        )
    if delete_image_labels_for_missing_types:
        ibs.db.executeone(
            """
            DELETE
            FROM {LBLIMAGE_TABLE}
            WHERE
                lbltype_rowid NOT IN (SELECT rowid FROM {LBLTYPE_TABLE})
            """.format(
                **const.__dict__
            )
        )
    if delete_annot_labels_for_missing_types:
        ibs.db.executeone(
            """
            DELETE
            FROM {LBLANNOT_TABLE}
            WHERE
                lbltype_rowid NOT IN (SELECT rowid FROM {LBLTYPE_TABLE})
            """.format(
                **const.__dict__
            )
        )
    # SECOND ORDER
    if delete_chips_for_missing_annotations:
        ibs.db.executeone(
            """
            DELETE
            FROM {CHIP_TABLE}
            WHERE
                annot_rowid NOT IN (SELECT rowid FROM {ANNOTATION_TABLE})
            """.format(
                **const.__dict__
            )
        )
        # OR config_rowid NOT IN (SELECT rowid FROM {CONFIG_TABLE})
    if delete_features_for_missing_annotations:
        ibs.db.executeone(
            """
            DELETE
            FROM {FEATURE_TABLE}
            WHERE
                chip_rowid NOT IN (SELECT rowid FROM {CHIP_TABLE})
            """.format(
                **const.__dict__
            )
        )
        # OR config_rowid NOT IN (SELECT rowid FROM {CONFIG_TABLE})
    if delete_invalid_eg_relations:
        ibs.db.executeone(
            """
            DELETE
            FROM {GSG_RELATION_TABLE}
            WHERE
                image_rowid NOT IN (SELECT rowid FROM {IMAGE_TABLE}) OR
                imageset_rowid NOT IN (SELECT rowid FROM {IMAGESET_TABLE})
            """.format(
                **const.__dict__
            )
        )
    # THIRD ORDER
    if delete_invalid_gl_relations:
        ibs.db.executeone(
            """
            DELETE
            FROM {GL_RELATION_TABLE}
            WHERE
                image_rowid NOT IN (SELECT rowid FROM {IMAGE_TABLE}) OR
                lblimage_rowid NOT IN (SELECT rowid FROM {LBLIMAGE_TABLE})
            """.format(
                **const.__dict__
            )
        )
        # OR config_rowid NOT IN (SELECT rowid FROM {CONFIG_TABLE})
    if delete_invalid_al_relations:
        ibs.db.executeone(
            """
            DELETE
            FROM {AL_RELATION_TABLE}
            WHERE
                annot_rowid NOT IN (SELECT rowid FROM {ANNOTATION_TABLE}) OR
                lblannot_rowid NOT IN (SELECT rowid FROM {LBLANNOT_TABLE})
            """.format(
                **const.__dict__
            )
        )
        # OR config_rowid NOT IN (SELECT rowid FROM {CONFIG_TABLE})