parameters: (code, lexer)
docstring: Lex ``code`` with ``lexer`` and return an iterable of tokens.
docstring_summary: Lex ``code`` with ``lexer`` and return an iterable of tokens.
docstring_tokens: Lex code with lexer and return an iterable of tokens .
function: def lex(code, lexer):
      """
      Lex ``code`` with ``lexer`` and return an iterable of tokens.
      """
      try:
          return lexer.get_tokens(code)
      except TypeError as err:
          if (isinstance(err.args[0], str) and
              ('unbound method get_tokens' in err.args[0] or
               'missing 1 required positional argument' in err.args[0])):
              raise TypeError('lex() argument must be a lexer instance, '
                              'not a class')
          raise
function_tokens: def lex ( code , lexer ) : try : return lexer . get_tokens ( code ) except TypeError as err : if ( isinstance ( err . args [ 0 ] , str ) and ( 'unbound method get_tokens' in err . args [ 0 ] or 'missing 1 required positional argument' in err . args [ 0 ] ) ) : raise TypeError ( 'lex() argument must be a lexer instance, ' 'not a class' ) raise