code: def _check_kets(*ops, same_space=False, disjunct_space=False):
      
      if not all([(isinstance(o, State) and o.isket) for o in ops]):
          raise TypeError("All operands must be Kets")
      if same_space:
          if not len({o.space for o in ops if o is not ZeroKet}) == 1:
              raise UnequalSpaces(str(ops))
      if disjunct_space:
          spc = TrivialSpace
          for o in ops:
              if o.space & spc > TrivialSpace:
                  raise OverlappingSpaces(str(ops))
              spc *= o.space
docs: Check that all operands are Kets from the same Hilbert space.