def __iter__(self):
        return iter(self.data)

    def __contains__(self, key):
        return key in self.data

    def __repr__(self):
        self._format_all()
        return repr(self.data)

    if config.PY_VERSION >= version.parse("3.9"):
        # merging with the union ("|") operator is supported in Python 3.9+

        def __or__(self, other):
            if isinstance(other, LazyDict):
                inst = self.copy()
                other = other.copy()
                other._format_all()
                inst.keys_to_format -= other.data.keys()
                inst.data = inst.data | other.data
                return inst
            if isinstance(other, dict):
                inst = self.copy()
                inst.keys_to_format -= other.keys()
                inst.data = inst.data | other
                return inst
            return NotImplemented