'Pop the first expression that appears in the agenda'

def pop_first(self):

    for (i, s) in enumerate(self.sets):
        if s:
            if (i in [Categories.N_EQ, Categories.ALL]):
                for ex in s:
                    try:
                        if (not ex[0]._exhausted):
                            s.remove(ex)
                            return (ex, i)
                    except AttributeError:
                        s.remove(ex)
                        return (ex, i)
            else:
                return (s.pop(), i)
    return ((None, None), None)
