def load(filename, mmap_mode=None):
    "Reconstruct a Python object from a file persisted with joblib.dump.\n\n    Parameters\n    -----------\n    filename: string\n        The name of the file from which to load the object\n    mmap_mode: {None, 'r+', 'r', 'w+', 'c'}, optional\n        If not None, the arrays are memory-mapped from the disk. This\n        mode has no effect for compressed files. Note that in this\n        case the reconstructed object might not longer match exactly\n        the originally pickled object.\n\n    Returns\n    -------\n    result: any Python object\n        The object stored in the file.\n\n    See Also\n    --------\n    joblib.dump : function to save an object\n\n    Notes\n    -----\n\n    This function can load numpy array files saved separately during the\n    dump. If the mmap_mode argument is given, it is passed to np.load and\n    arrays are loaded as memmaps. As a consequence, the reconstructed\n    object might not match the original pickled object. Note that if the\n    file was saved with compression, the arrays cannot be memmaped.\n    "
    with open(filename, 'rb') as file_handle:
        if (_read_magic(file_handle) == _ZFILE_PREFIX):
            if (mmap_mode is not None):
                warnings.warn(('file "%(filename)s" appears to be a zip, ignoring mmap_mode "%(mmap_mode)s" flag passed' % locals()), Warning, stacklevel=2)
            unpickler = ZipNumpyUnpickler(filename, file_handle=file_handle)
        else:
            unpickler = NumpyUnpickler(filename, file_handle=file_handle, mmap_mode=mmap_mode)
        try:
            obj = unpickler.load()
        except UnicodeDecodeError as exc:
            if PY3_OR_LATER:
                new_exc = ValueError('You may be trying to read with python 3 a joblib pickle generated with python 2. This feature is not supported by joblib.')
                new_exc.__cause__ = exc
                raise new_exc
        finally:
            if hasattr(unpickler, 'file_handle'):
                unpickler.file_handle.close()
        return obj
Reconstruct a Python object from a file persisted with joblib.dump.

Parameters
-----------
filename: string
    The name of the file from which to load the object
mmap_mode: {None, 'r+', 'r', 'w+', 'c'}, optional
    If not None, the arrays are memory-mapped from the disk. This
    mode has no effect for compressed files. Note that in this
    case the reconstructed object might not longer match exactly
    the originally pickled object.

Returns
-------
result: any Python object
    The object stored in the file.

See Also
--------
joblib.dump : function to save an object

Notes
-----

This function can load numpy array files saved separately during the
dump. If the mmap_mode argument is given, it is passed to np.load and
arrays are loaded as memmaps. As a consequence, the reconstructed
object might not match the original pickled object. Note that if the
file was saved with compression, the arrays cannot be memmaped.
def load(filename, mmap_mode=None):
    "Reconstruct a Python object from a file persisted with joblib.dump.\n\n    Parameters\n    -----------\n    filename: string\n        The name of the file from which to load the object\n    mmap_mode: {None, 'r+', 'r', 'w+', 'c'}, optional\n        If not None, the arrays are memory-mapped from the disk. This\n        mode has no effect for compressed files. Note that in this\n        case the reconstructed object might not longer match exactly\n        the originally pickled object.\n\n    Returns\n    -------\n    result: any Python object\n        The object stored in the file.\n\n    See Also\n    --------\n    joblib.dump : function to save an object\n\n    Notes\n    -----\n\n    This function can load numpy array files saved separately during the\n    dump. If the mmap_mode argument is given, it is passed to np.load and\n    arrays are loaded as memmaps. As a consequence, the reconstructed\n    object might not match the original pickled object. Note that if the\n    file was saved with compression, the arrays cannot be memmaped.\n    "
    with open(filename, 'rb') as file_handle:
        if (_read_magic(file_handle) == _ZFILE_PREFIX):
            if (mmap_mode is not None):
                warnings.warn(('file "%(filename)s" appears to be a zip, ignoring mmap_mode "%(mmap_mode)s" flag passed' % locals()), Warning, stacklevel=2)
            unpickler = ZipNumpyUnpickler(filename, file_handle=file_handle)
        else:
            unpickler = NumpyUnpickler(filename, file_handle=file_handle, mmap_mode=mmap_mode)
        try:
            obj = unpickler.load()
        except UnicodeDecodeError as exc:
            if PY3_OR_LATER:
                new_exc = ValueError('You may be trying to read with python 3 a joblib pickle generated with python 2. This feature is not supported by joblib.')
                new_exc.__cause__ = exc
                raise new_exc
        finally:
            if hasattr(unpickler, 'file_handle'):
                unpickler.file_handle.close()
        return obj