def dumppickle(obj, fname, protocol=-1):
    """
    Pickle object `obj` to file `fname`.
    """
    with open(fname, 'wb') as fout:  # 'b' for binary, needed on Windows
        pickle.dump(obj, fout, protocol=protocol)
Pickle object `obj` to file `fname`.