code: def immutable_worker(worker, state, pre_state, created):
      
      # noinspection PyUnresolvedReferences,PyProtectedMember
      return WorkerData._make(chain(
          (getattr(worker, f) for f in WORKER_OWN_FIELDS),
          (state, pre_state, created),
          (worker.heartbeats[-1] if worker.heartbeats else None,),
      ))
docs: Converts to an immutable slots class to handle internally.