code: def from_future(cls, future, result_hook=None):
          
          obj = cls.__new__(cls)
          obj._future = future
  
          if result_hook is None:
              def result_hook(future):
                  return future.result()
          elif not callable(result_hook):
              raise TypeError("expected result_hook to be callable")
  
          obj._result_hook = result_hook
          return obj
docs: Construct a :class:`SampleSet` referencing the result of a future computation.
  
          Args:
              future (object):
                  Object that contains or will contain the information needed to construct a
                  :class:`SampleSet`. If `future` has a :meth:`~concurrent.futures.Future.done` method,
                  this determines the value returned by :meth:`.SampleSet.done`.
  
              result_hook (callable, optional):
                  A function that is called to resolve the future. Must accept the future and return
                  a :obj:`.SampleSet`. If not provided, set to
  
                  .. code-block:: python
  
                      def result_hook(future):
                          return future.result()
  
          Returns:
              :obj:`.SampleSet`
  
          Notes:
              The future is resolved on the first read of any of the :class:`SampleSet` properties.
  
          Examples:
              Run a dimod sampler on a single thread and load the returned future into :class:`SampleSet`.
  
              >>> import dimod
              >>> from concurrent.futures import ThreadPoolExecutor
              ...
              >>> bqm = dimod.BinaryQuadraticModel.from_ising({}, {('a', 'b'): -1})
              >>> with ThreadPoolExecutor(max_workers=1) as executor:
              ...     future = executor.submit(dimod.ExactSolver().sample, bqm)
              ...     sampleset = dimod.SampleSet.from_future(future)
              >>> sampleset.record
              rec.array([([-1, -1], -1., 1), ([ 1, -1],  1., 1), ([ 1,  1], -1., 1),
                         ([-1,  1],  1., 1)],
                        dtype=[('sample', 'i1', (2,)), ('energy', '<f8'), ('num_occurrences', '<i8')])