def _flatten(
        self, val: Any, lens: Optional[serial_utils.Lens] = None
    ) -> Iterable[Tuple[serial_utils.Lens, Any]]:
        """Flatten the API diff for easier comparison."""

        if lens is None:
            lens = serial_utils.Lens()

        if len(lens) > 1 or isinstance(val, (str, int, float, bool)):
            yield (lens, val)
        elif isinstance(val, dict):
            for k, v in val.items():
                yield from self._flatten(val=v, lens=lens[k])
        elif isinstance(val, Sequence):
            for i, v in enumerate(val):
                yield from self._flatten(val=v, lens=lens[i])
        else:
            raise ValueError(f"Unexpected type {type(val)}")
Flatten the API diff for easier comparison.
tests/unit/static/test_api.py