from typing import Optional


def get_active_task_state(code: int) -> Optional[str]:
    """Translate an active task state code to a human-readable state.

    Official mapping is available
    `here <https://github.com/BOINC/boinc/blob/master/py/Boinc/boinc_db.py>`.

    Args:
      code:
        The code of the activate task state.

    Returns:
      The human-readable state related to the code.
    """

    states = {
        0: "UNINITIALIZED",
        1: "EXECUTING",
        2: "EXITED",
        3: "SIGNALED",
        4: "EXIT_UNKNOWN",
        5: "ABORT_PENDING",
        6: "ABORTED",
        7: "COULDNT_START",
        8: "QUIT_PENDING",
        9: "SUSPENDED",
        10: "COPY_PENDING",
    }
    return states.get(int(code))