code: def impute_and_confidence(self, M_c, X_L, X_D, Y, Q, seed, n):
          
          get_next_seed = make_get_next_seed(seed)
          if isinstance(X_L, (list, tuple)):
              assert isinstance(X_D, (list, tuple))
              # TODO: multistate impute doesn't exist yet
              # e,confidence = su.impute_and_confidence_multistate(
              #   M_c, X_L, X_D, Y, Q, n, self.get_next_seed)
              e, confidence = su.impute_and_confidence(
                  M_c, X_L, X_D, Y, Q, n, get_next_seed)
          else:
              e, confidence = su.impute_and_confidence(
                  M_c, X_L, X_D, Y, Q, n, get_next_seed)
          return (e, confidence)
docs: Impute values and confidence of the value from the predictive
          distribution of the given latent state.
  
          :param Y: A list of constraints to apply when sampling.  Each constraint
              is a triplet of (r, d, v): r is the row index, d is the column
              index and v is the value of the constraint
          :type Y: list of lists
          :param Q: A list of values to sample.  Each value is doublet of (r, d):
              r is the row index, d is the column index
          :type Q: list of lists
          :param n: the number of samples to use in the imputation
          :type n: int
  
          :returns: list of lists -- list of (value, confidence) tuples in the
              same order as specified by Q