<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def statusfmt(status):
 """ Format an exit status as text. """

    if status == 0:
        msg = 'exited ok'
    elif os.WIFSIGNALED(status):
        msg = 'died on '+signame(os.WTERMSIG(status))
    elif os.WIFEXITED(status) and os.WEXITSTATUS(status) > 0:
        msg = 'exited '+str(os.WEXITSTATUS(status))
    else:
        msg = 'unknown exit code 0x%04x' % (status,)
    if os.WCOREDUMP(status):
        msg += ' (core dumped)'
    return msg