code: def parse_cnf(s, varname='x'):
      
      lexer = iter(CNFLexer(s))
      try:
          ast = _cnf(lexer, varname)
      except lex.RunError as exc:
          fstr = ("{0.args[0]}: "
                  "(line: {0.lineno}, offset: {0.offset}, text: {0.text})")
          raise Error(fstr.format(exc))
  
      # Check for end of buffer
      _expect_token(lexer, {EndToken})
  
      return ast
docs: Parse an input string in DIMACS CNF format,
      and return an expression abstract syntax tree.
  
      Parameters
      ----------
      s : str
          String containing a DIMACS CNF.
  
      varname : str, optional
          The variable name used for creating literals.
          Defaults to 'x'.
  
      Returns
      -------
      An ast tuple, defined recursively:
  
      ast := ('var', names, indices)
           | ('not', ast)
           | ('or', ast, ...)
           | ('and', ast, ...)
  
      names := (name, ...)
  
      indices := (index, ...)