def fastcsv_reader(f, dialect_name):
    try:
        module = __import__('_fastcsv_' + dialect_name)
    except ImportError:
        _make_ffi_from_dialect(dialect_name)
        module = __import__('_fastcsv_' + dialect_name)
    ffi, lib = module.ffi, module.lib
    #
    linelen = -1
    for line in f:
        if linelen <= len(line):
            linelen = 2 * len(line)
            rawline = ffi.new("char[]", linelen)
        ffi.buffer(rawline, len(line))[:] = line
        n = lib.parse_line(rawline, len(line))
        assert n >= 0
        yield ffi.buffer(rawline, n)[:].split('\x00')
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/cffi-1.5.2/demo/fastcsv.py/fastcsv_reader/original