def run_state(proc, state_table):
    """
    Returns the name of the state that matches the return code of proc.
    Assumes proc has already executed. See parse_states.
    """
    return state_table.get(proc.returncode, "error")