def readLoop(self, cargo):
        """ Keep reading lines until a change to next state is triggered """
        cargo.buffer = []
        next = ()
        while not next:
            line = cargo.fp.readline()
            
            if not line:
                next = self.END, (cargo)
            else:
                for matchRe in cargo.navigation.keys():
                    if self.match(cargo, matchRe, line):
                        state = cargo.navigation[matchRe]
                        next = state, (cargo)
                        break
                    
            if not next:
                cargo.buffer.append(line)
                #print "BUFFER:", line
            
        return next
 Keep reading lines until a change to next state is triggered 
recipes/Python/574430_Line_Oriented_State_Machine/recipe-574430.py