def choose_state_to_del(G, StatesLeft):
    """Helper for del_gnfa_states
       ---
       Given a GNFA G and a list StatesLeft,
       choose first eligible state to delete, and return it
       plus the set of non-deleted entries. 
       Called only if there is an eligible state to be deleted.
    """
    for q in StatesLeft: 
        if (q not in G["Q0"] | G["F"]):
            # There is one eligible state to delete
            return ( q, [x for x in StatesLeft if x != q] )