def METHOD_NAME(request, instance, action):
    approved = action == 'approve'
    photo_ids = get_ids_from_request(request)
    for photo_id in photo_ids:
        try:
            photo = (MapFeaturePhoto.objects
                     .select_related('treephoto')
                     .get(pk=photo_id))
            try:
                photo = photo.treephoto
            except MapFeaturePhoto.DoesNotExist:
                pass  # There is no tree photo, so use the superclass
        except MapFeaturePhoto.DoesNotExist:
            # This may be a pending tree. Let's see if there
            # are pending audits
            pending_audits = Audit.objects\
                .filter(instance=instance)\
                .filter(model__in=['TreePhoto', 'MapFeaturePhoto'])\
                .filter(model_id=photo_id)\
                .filter(requires_auth=True)
            if len(pending_audits) > 0:
                # Process as pending and quit
                approve_or_reject_audits_and_apply(
                    pending_audits, request.user, approved)
                return photo_review(request, instance)
            else:
                # Error - no pending or regular
                raise Http404('Photo Not Found')
        # Handle the id audit first
        all_audits = []
        for audit in photo.audits():
            if audit.field == 'id':
                all_audits = [audit] + all_audits
            else:
                all_audits.append(audit)
        for audit in all_audits:
            approve_or_reject_existing_edit(
                audit, request.user, approved)
    return photo_review(request, instance)