def dump(stuff, filename, verbose=True, protocol=<NUM_LIT:3>):
filename = os.path.normcase(filename)<EOL>dir_path = os.path.dirname(filename)<EOL>if not os.path.exists(dir_path): os.makedirs(dir_path)<EOL>with open(filename, '<STR_LIT:wb>') as f:<EOL><INDENT>p = pickle.Pickler(f, protocol=protocol)<EOL>p.dump(stuff)<EOL><DEDENT>if verbose:<EOL><INDENT>print('<STR_LIT>'.format(len(stuff), filename))<EOL><DEDENT>return filename<EOL>
Store an object to file by pickling

    Parameters
    ----------
    stuff : object to be pickled
    filename : path
    verbose : bool
    protocol : 1,2,3 (default = 3)
        Protocol used by Pickler, higher number means more recent version of Python is needed to read the pickle
        produced. Default is protocol=3, which only works with Python 3+

    Return
    ------
    path
        Path where pickled object was saved.