code: def state_reachable(subsystem):
      
      # If there is a row `r` in the TPM such that all entries of `r - state` are
      # between -1 and 1, then the given state has a nonzero probability of being
      # reached from some state.
      # First we take the submatrix of the conditioned TPM that corresponds to
      # the nodes that are actually in the subsystem...
      tpm = subsystem.tpm[..., subsystem.node_indices]
      # Then we do the subtraction and test.
      test = tpm - np.array(subsystem.proper_state)
      if not np.any(np.logical_and(-1 < test, test < 1).all(-1)):
          raise exceptions.StateUnreachableError(subsystem.state)
docs: Return whether a state can be reached according to the network's TPM.