code: def readline(self):
          
          line = self.file.readline()
          if self.grammar and line:
              try:
                  return self.grammar.parseString(line).asDict()
              except ParseException:
                  return self.readline()
          else:
              return line
docs: Reads (and optionally parses) a single line.