code: def savemat(
      file_name,
      mdict,
      appendmat=True,
      format="5",
      long_field_names=False,
      do_compression=False,
      oned_as="row",
  ):
      """
      Save a dictionary of names and arrays into a MATLAB-style .mat file.
  
      This saves the array objects in the given dictionary to a MATLAB-
      style .mat file.
  
      Parameters
      ----------
      file_name : str or file-like object
          Name of the .mat file (.mat extension not needed if ``appendmat ==
          True``).
          Can also pass open file_like object.
      mdict : dict
          Dictionary from which to save matfile variables.
      appendmat : bool, optional
          True (the default) to append the .mat extension to the end of the
          given filename, if not already present.
      format : {'5', '4'}, string, optional
          '5' (the default) for MATLAB 5 and up (to 7.2),
          '4' for MATLAB 4 .mat files.
      long_field_names : bool, optional
          False (the default) - maximum field name length in a structure is
          31 characters which is the documented maximum length.
          True - maximum field name length in a structure is 63 characters
          which works for MATLAB 7.6+.
      do_compression : bool, optional
          Whether or not to compress matrices on write.  Default is False.
      oned_as : {'row', 'column'}, optional
          If 'column', write 1-D numpy arrays as column vectors.
          If 'row', write 1-D numpy arrays as row vectors.
  
      See also
      --------
      mio4.MatFile4Writer
      mio5.MatFile5Writer
      """
      file_opened = False
      if hasattr(file_name, "write"):
          # File-like object already; use as-is
          file_stream = file_name
      else:
          if isinstance(file_name, string_types):
              if appendmat and not file_name.endswith(".mat"):
                  file_name = file_name + ".mat"
  
          file_stream = open(file_name, "wb")
          file_opened = True
  
      if format == "4":
          if long_field_names:
              raise ValueError(
                  "Long field names are not available for version 4 files"
              )
          MW = MatFile4Writer(file_stream, oned_as)
      elif format == "5":
          MW = MatFile5Writer(
              file_stream,
              do_compression=do_compression,
              unicode_strings=True,
              long_field_names=long_field_names,
              oned_as=oned_as,
          )
      else:
          raise ValueError("Format should be '4' or '5'")
      MW.put_variables(mdict)
      if file_opened:
          file_stream.close()
  
file_path: catboost/contrib/python/scipy/py2/scipy/io/matlab/mio.py
imports: from __future__ import division, print_function, absolute_import
  from scipy._lib.six import string_types
  from .miobase import get_matfile_version, docfiller
  from .mio4 import MatFile4Reader, MatFile4Writer
  from .mio5 import MatFile5Reader, MatFile5Writer
label_desc: Use image node_id 4 for calling a global function with example usage: savemat(file_name, mdict, appendmat, format, long_field_names, do_compression, oned_as) without return types