docs: def _process_blob(sampler, modelidx, last_step=False, energy=None):
      """
      Process binary blob in sampler. If blob in position modelidx is:
  
      - a Quantity array of len(blob[i])=len(data['energy']: use blob as model,
        data['energy'] as modelx
      - a tuple: use first item as modelx, second as model
      - a Quantity scalar: return array of scalars
      """
  
      # Allow process blob to be used by _calc_samples and _calc_ML by sending
      # only blobs, not full sampler
      if hasattr(sampler, "blobs"):
          blob0 = sampler.blobs[-1][0][modelidx]
          blobs = sampler.blobs
          energy = sampler.data["energy"]
      else:
          blobs = [sampler]
          blob0 = sampler[0][modelidx]
          last_step = True
  
      if isinstance(blob0, u.Quantity):
          if blob0.size == energy.size:
              # Energy array for blob is not provided, use data['energy']
              modelx = energy
          elif blob0.size == 1:
              modelx = None
  
          if last_step:
              model = u.Quantity([m[modelidx] for m in blobs[-1]])
          else:
              model = []
              for step in blobs:
                  for walkerblob in step:
                      model.append(walkerblob[modelidx])
              model = u.Quantity(model)
      elif np.isscalar(blob0):
          modelx = None
  
          if last_step:
              model = u.Quantity([m[modelidx] for m in blobs[-1]])
          else:
              model = []
              for step in blobs:
                  for walkerblob in step:
                      model.append(walkerblob[modelidx])
              model = u.Quantity(model)
      elif isinstance(blob0, list) or isinstance(blob0, tuple):
          if (
              len(blob0) == 2
              and isinstance(blob0[0], u.Quantity)
              and isinstance(blob0[1], u.Quantity)
          ):
              # Energy array for model is item 0 in blob, model flux is item 1
              modelx = blob0[0]
  
              if last_step:
                  model = u.Quantity([m[modelidx][1] for m in blobs[-1]])
              else:
                  model = []
                  for step in blobs:
                      for walkerblob in step:
                          model.append(walkerblob[modelidx][1])
                  model = u.Quantity(model)
          else:
              raise TypeError("Model {0} has wrong blob format".format(modelidx))
  
      else:
          raise TypeError("Model {0} has wrong blob format".format(modelidx))
  
      return modelx, model