Succeed or fail an item based on the return code of a program

def done_item(item, code):
    '''Succeed or fail an item based on the return code of a program'''
    try:
        if const('FSQ_SUCCESS') == code:
            success(item)
            chirp('{0}: succeeded'.format(item.id))
        elif const('FSQ_FAIL_TMP') == code:
            fail_tmp(item)
            shout('{0}: failed temporarily'.format(item.id))
        else:
            fail_perm(item)
            shout('{0}: failed permanantly'.format(item.id))
    except FSQEnqueueError, e:
        shout(e.strerror.encode(_CHARSET))
        return -1
    except FSQError, e:
        shout(e.strerror.encode(_CHARSET))
    return 0