def preserve_old_sideeffect_values(
        self, old_obj, new_obj, object_sideeffect_fields, common_sideeffect_fields
    ):
        """
        Try to preserve values of side-effect fields from old_obj,
        to reduce churn in fixtures
        """
        object_name = new_obj.get("object")
        sideeffect_fields = object_sideeffect_fields.get(object_name, set()).union(
            set(common_sideeffect_fields)
        )

        old_obj = old_obj or {}

        for f, old_val in old_obj.items():
            try:
                new_val = new_obj[f]
            except KeyError:
                continue

            if isinstance(new_val, ListObject):
                # recursively process nested lists
                for n, (old_val_item, new_val_item) in enumerate(
                    zip(old_val.get("data", []), new_val.data)
                ):
                    new_val.data[n] = self.preserve_old_sideeffect_values(
                        old_obj=old_val_item,
                        new_obj=new_val_item,
                        object_sideeffect_fields=object_sideeffect_fields,
                        common_sideeffect_fields=common_sideeffect_fields,
                    )
            elif isinstance(new_val, StripeObject):
                # recursively process nested objects
                new_obj[f] = self.preserve_old_sideeffect_values(
                    old_obj=old_val,
                    new_obj=new_val,
                    object_sideeffect_fields=object_sideeffect_fields,
                    common_sideeffect_fields=common_sideeffect_fields,
                )
            elif (
                f in sideeffect_fields
                and type(old_val) is type(new_val)
                and old_val != new_val
            ):
                # only preserve old values if the type is the same
                new_obj[f] = old_val

        return new_obj

        Try to preserve values of side-effect fields from old_obj,
        to reduce churn in fixtures
        
tests/apps/example/management/commands/regenerate_test_fixtures.py