def map_by_authority(model_objects):
    """Return a dictionary keying model_objects by each object's
    authority_id."""
    object_map = {}
    for model_object in model_objects:
        authority_id = model_object.authority_id
        if authority_id in object_map:
            object_map[authority_id].append(model_object)
        else:
            object_map[authority_id] = [model_object]
    return object_map