code: def sample_poly(self, poly, **kwargs):
          child = self.child
          cutoff = self._cutoff
          cutoff_vartype = self._cutoff_vartype
          comp = self._comparison
          if cutoff_vartype is dimod.SPIN:
              original = poly.to_spin(copy=False)
          else:
              original = poly.to_binary(copy=False)
          new = type(poly)(((term, bias) for term, bias in original.items()
                            if len(term) > 1 and not comp(abs(bias), cutoff)),
                           cutoff_vartype)
          for v in new.variables:
              term = v,
              if term in original:
                  new[term] = original[term]
          isolated = list(original.variables.difference(new.variables))
          if isolated and len(new) == 0:
              term = isolated.pop(),
              new[term] = original[term]
          sampleset = child.sample_poly(new, **kwargs).change_vartype(poly.vartype, inplace=True)
          if isolated:
              samples, variables = _restore_isolated_higherorder(sampleset, poly, isolated)
          else:
              samples = sampleset.record.sample
              variables = sampleset.variables
          vectors = sampleset.data_vectors
          vectors.pop('energy')
          return dimod.SampleSet.from_samples_bqm((samples, variables), poly, **vectors)