def __new__(cls, name: str) -> cirq.NamedQubit:
        """Initializes a `NamedQid` with a given name and dimension.

        Args:
            name: The name.
            dimension: The dimension of the qid's Hilbert space, i.e.
                the number of quantum levels.
        """
        inst = cls._cache.get(name)
        if inst is None:
            inst = super().__new__(cls)
            inst._name = name
            cls._cache[name] = inst
        return inst
Initializes a `NamedQid` with a given name and dimension.

        Args:
            name: The name.
            dimension: The dimension of the qid's Hilbert space, i.e.
                the number of quantum levels.
        
cirq-core/cirq/ops/named_qubit.py