code: def penalty_satisfaction(response, bqm):
      
      record = response.record
      label_dict = response.variables.index
  
      if len(bqm.info['reduction']) == 0:
          return np.array([1] * len(record.sample))
  
      penalty_vector = np.prod([record.sample[:, label_dict[qi]] *
                                record.sample[:, label_dict[qj]]
                                == record.sample[:,
                                   label_dict[valdict['product']]]
                                for (qi, qj), valdict in
                                bqm.info['reduction'].items()], axis=0)
      return penalty_vector
docs: Creates a penalty satisfaction list
  
      Given a sampleSet and a bqm object, will create a binary list informing
      whether the penalties introduced during degree reduction are satisfied for
      each sample in sampleSet
  
      Args:
          response (:obj:`.SampleSet`): Samples corresponding to provided bqm
  
          bqm (:obj:`.BinaryQuadraticModel`): a bqm object that contains
              its reduction info.
  
      Returns:
          :obj:`numpy.ndarray`: a binary array of penalty satisfaction information