def insert_sort_key(event):
    """Sort / group function that batches events that share the same
    SCID and set of fields. We need to group together events that
    belong to the same schema AND that have the same set of fields.
    Please note that schemas allow for optional fields that might/might
    not have been included in the event.
    """
    return (event['schema'], event['revision']), tuple(sorted(event))
