def load_csv(filename, **kw):
    '''
    load_csv(filename) yields a pandas dataframe of the contents of the CSV file. If pandas cannot
      be loaded, then an error is raised.

    All optional arguments are passed along to the pandas.read_csv function.
    '''
    import pandas
    if any(filename.endswith(s) for s in ('.gz', '.bz2', '.lzma')):
        with gzip.open(filename, 'rt') as fl: data = pandas.read_csv(fl, **kw)
    else:
        with open(filename, 'rt') as fl: data = pandas.read_csv(fl, **kw)
    return data
load_csv(filename) yields a pandas dataframe of the contents of the CSV file. If pandas cannot
      be loaded, then an error is raised.

    All optional arguments are passed along to the pandas.read_csv function.