docs: def next_basis_label_or_index(self, label_or_index, n=1):
          """Given the label or index of a basis state, return the label/index of
          the next basis state.
  
          More generally, if `n` is given, return the `n`'th next basis state
          label/index; `n` may also be negative to obtain previous basis state
          labels/indices.
  
          The return type is the same as the type of `label_or_index`.
  
          Args:
              label_or_index (int or str or SymbolicLabelBase): If `int`, the
                  index of a basis state; if `str`, the label of a basis state
              n (int): The increment
  
          Raises:
              IndexError: If going beyond the last or first basis state
              ValueError: If `label` is not a label for any basis state in the
                  Hilbert space
              .BasisNotSetError: If the Hilbert space has no defined basis
              TypeError: if `label_or_index` is neither a :class:`str` nor an
                  :class:`int`, nor a :class:`SymbolicLabelBase`
          """
          if isinstance(label_or_index, int):
              new_index = label_or_index + n
              if new_index < 0:
                  raise IndexError("index %d < 0" % new_index)
              if self.has_basis:
                  if new_index >= self.dimension:
                      raise IndexError("index %d out of range for basis %s"
                                       % (new_index, self._basis))
              return new_index
          elif isinstance(label_or_index, str):
              label_index = self.basis_labels.index(label_or_index)
              new_index = label_index + n
              if (new_index < 0) or (new_index >= len(self._basis)):
                  raise IndexError("index %d out of range for basis %s"
                                   % (new_index, self._basis))
              return self._basis[new_index]
          elif isinstance(label_or_index, SymbolicLabelBase):
              return label_or_index.__class__(expr=label_or_index.expr + n)
          else:
              raise TypeError(
                  "Invalid type for label_or_index: %s"
                  % label_or_index.__class__.__name__)