def immutable_task(task, state, pre_state, created):
    """Converts to an immutable slots class to handle internally."""
    # noinspection PyUnresolvedReferences,PyProtectedMember
    return TaskData._make(chain(
        (getattr(task, f) for f in TASK_OWN_FIELDS),
        (state, pre_state, created),
    ))
Converts to an immutable slots class to handle internally.