code: def dimod_object_hook(obj):
      
      if _is_sampleset_v2(obj):
          # in the future we could handle subtypes but right now we just have the
          # one
          return SampleSet.from_serializable(obj)
      elif _is_bqm_v2(obj):
          # in the future we could handle subtypes but right now we just have the
          # one
          return BinaryQuadraticModel.from_serializable(obj)
      return obj
docs: JSON-decoding for dimod objects.
  
      See Also:
          :class:`json.JSONDecoder` for using custom decoders.