def format_state(state): if not state or state not in STATES.keys(): return 'Not set' return STATES[state]