Move code for status to reusable function

Benjamin Mako Hill || Want to submit a patch?