code: def sample_ising(self, h, J, **kwargs):
          
          if isinstance(h, list):
              h = dict(enumerate(h))
  
          variables = set(h).union(*J)
          try:
              active_variables = sorted(variables)
          except TypeError:
              active_variables = list(variables)
          num_variables = len(active_variables)
  
          future = self.solver.sample_ising(h, J, **kwargs)
  
          return dimod.SampleSet.from_future(future, _result_to_response_hook(active_variables, dimod.SPIN))
docs: Sample from the specified Ising model.
  
          Args:
              h (list/dict):
                  Linear biases of the Ising model. If a list, the list's indices are
                  used as variable labels.
  
              J (dict[(int, int): float]):
                  Quadratic biases of the Ising model.
  
              **kwargs:
                  Optional keyword arguments for the sampling method, specified per solver in
                  :attr:`.DWaveSampler.parameters`
  
          Returns:
              :class:`dimod.SampleSet`: A `dimod` :obj:`~dimod.SampleSet` object.
  
          Examples:
              This example submits a two-variable Ising problem mapped directly to qubits
              0 and 1 on a D-Wave system selected by the user's default
              :std:doc:`D-Wave Cloud Client configuration file <cloud-client:intro>`.
  
              >>> from dwave.system.samplers import DWaveSampler
              >>> sampler = DWaveSampler()
              >>> response = sampler.sample_ising({0: -1, 1: 1}, {})
              >>> for sample in response.samples():    # doctest: +SKIP
              ...    print(sample)
              ...
              {0: 1, 1: -1}
  
          See `Ocean Glossary <https://docs.ocean.dwavesys.com/en/latest/glossary.html>`_
          for explanations of technical terms in descriptions of Ocean tools.