code: def dump(value, filename, compress=0, protocol=None, cache_size=None):
      """Persist an arbitrary Python object into one file.
  
      Read more in the :ref:`User Guide <persistence>`.
  
      Parameters
      ----------
      value: any Python object
          The object to store to disk.
      filename: str, pathlib.Path, or file object.
          The file object or path of the file in which it is to be stored.
          The compression method corresponding to one of the supported filename
          extensions ('.z', '.gz', '.bz2', '.xz' or '.lzma') will be used
          automatically.
      compress: int from 0 to 9 or bool or 2-tuple, optional
          Optional compression level for the data. 0 or False is no compression.
          Higher value means more compression, but also slower read and
          write times. Using a value of 3 is often a good compromise.
          See the notes for more details.
          If compress is True, the compression level used is 3.
          If compress is a 2-tuple, the first element must correspond to a string
          between supported compressors (e.g 'zlib', 'gzip', 'bz2', 'lzma'
          'xz'), the second element must be an integer from 0 to 9, corresponding
          to the compression level.
      protocol: int, optional
          Pickle protocol, see pickle.dump documentation for more details.
      cache_size: positive int, optional
          This option is deprecated in 0.10 and has no effect.
  
      Returns
      -------
      filenames: list of strings
          The list of file names in which the data is stored. If
          compress is false, each array is stored in a different file.
  
      See Also
      --------
      joblib.load : corresponding loader
  
      Notes
      -----
      Memmapping on load cannot be used for compressed files. Thus
      using compression can significantly slow down loading. In
      addition, compressed files take up extra memory during
      dump and load.
  
      """
  
      if Path is not None and isinstance(filename, Path):
          filename = str(filename)
  
      is_filename = isinstance(filename, str)
      is_fileobj = hasattr(filename, "write")
  
      compress_method = (
          "zlib"  # zlib is the default compression method.
      )
      if compress is True:
          # By default, if compress is enabled, we want the default compress
          # level of the compressor.
          compress_level = None
      elif isinstance(compress, tuple):
          # a 2-tuple was set in compress
          if len(compress) != 2:
              raise ValueError(
                  "Compress argument tuple should contain exactly 2 elements: "
                  "(compress method, compress level), you passed {}".format(
                      compress
                  )
              )
          compress_method, compress_level = compress
      elif isinstance(compress, str):
          compress_method = compress
          compress_level = None  # Use default compress level
          compress = (compress_method, compress_level)
      else:
          compress_level = compress
  
      if compress_method == "lz4" and lz4 is None:
          raise ValueError(LZ4_NOT_INSTALLED_ERROR)
  
      if (
          compress_level is not None
          and compress_level is not False
          and compress_level not in range(10)
      ):
          # Raising an error if a non valid compress level is given.
          raise ValueError(
              'Non valid compress level given: "{}". Possible values are '
              "{}.".format(compress_level, list(range(10)))
          )
  
      if compress_method not in _COMPRESSORS:
          # Raising an error if an unsupported compression method is given.
          raise ValueError(
              'Non valid compression method given: "{}". Possible values are '
              "{}.".format(compress_method, _COMPRESSORS)
          )
  
      if not is_filename and not is_fileobj:
          # People keep inverting arguments, and the resulting error is
          # incomprehensible
          raise ValueError(
              "Second argument should be a filename or a file-like object, "
              "%s (type %s) was given." % (filename, type(filename))
          )
  
      if is_filename and not isinstance(compress, tuple):
          # In case no explicit compression was requested using both compression
          # method and level in a tuple and the filename has an explicit
          # extension, we select the corresponding compressor.
  
          # unset the variable to be sure no compression level is set afterwards.
          compress_method = None
          for name, compressor in _COMPRESSORS.items():
              if filename.endswith(compressor.extension):
                  compress_method = name
  
          if compress_method in _COMPRESSORS and compress_level == 0:
              # we choose the default compress_level in case it was not given
              # as an argument (using compress).
              compress_level = None
  
      if cache_size is not None:
          # Cache size is deprecated starting from version 0.10
          warnings.warn(
              "Please do not set 'cache_size' in joblib.dump, "
              "this parameter has no effect and will be removed. "
              "You used 'cache_size={}'".format(cache_size),
              DeprecationWarning,
              stacklevel=2,
          )
  
      if compress_level != 0:
          with _write_fileobject(
              filename, compress=(compress_method, compress_level)
          ) as f:
              NumpyPickler(f, protocol=protocol).dump(value)
      elif is_filename:
          with open(filename, "wb") as f:
              NumpyPickler(f, protocol=protocol).dump(value)
      else:
          NumpyPickler(filename, protocol=protocol).dump(value)
  
      # If the target container is a file object, nothing is returned.
      if is_fileobj:
          return
  
      # For compatibility, the list of created filenames (e.g with one element
      # after 0.10.0) is returned by default.
      return [filename]
  
imports: import pickle
  import os
  import warnings
  import io
  from pathlib import Path
  from .compressor import lz4, LZ4_NOT_INSTALLED_ERROR
  from .compressor import _COMPRESSORS, register_compressor, BinaryZlibFile
  from .compressor import ZlibCompressorWrapper, GzipCompressorWrapper, BZ2CompressorWrapper, LZMACompressorWrapper, XZCompressorWrapper, LZ4CompressorWrapper
  from .numpy_pickle_utils import Unpickler, Pickler
  from .numpy_pickle_utils import _read_fileobject, _write_fileobject
  from .numpy_pickle_utils import _read_bytes, BUFFER_SIZE
  from .numpy_pickle_utils import _ensure_native_byte_order
  from .numpy_pickle_compat import load_compatibility
  from .numpy_pickle_compat import NDArrayWrapper
  from .numpy_pickle_compat import ZNDArrayWrapper
  from .backports import make_memmap
label_desc: Use image node_id 1 for calling a global function with example usage: dump(value, filename, compress, protocol, cache_size) and returns: list