@joshk: This isn't a one-liner anymore because adding in the check against FAILED_STATES would have made it unclear.