def METHOD_NAME(self, data):
    if not data.get("unique_ids") and not data.get("principal_names"):
        raise serializers.ValidationError("Unique ids and principal names cannot be both empty.")
    return data