def lex(code, lexer):
    """
    Lex ``code`` with ``lexer`` and return an iterable of tokens.
    """
    try:
        return lexer.get_tokens(code)
    except TypeError, err:
        if isinstance(err.args[0], str) and \
           err.args[0] in 'unbound method get_tokens':
            raise TypeError('lex() argument must be a lexer instance, '
                            'not a class')
        raise
dataset/ETHPy150Open darcyliu/storyboard/pygments/__init__.py/lex/swapped operands of `in`