code: def _dump_svmlight(X, y, f, multilabel, one_based, comment, query_id):
      if comment:
          f.write(
              (
                  "# Generated by dump_svmlight_file from scikit-learn %s\n"
                  % __version__
              ).encode()
          )
          f.write(
              (
                  "# Column indices are %s-based\n"
                  % ["zero", "one"][one_based]
              ).encode()
          )
  
          f.write(b"#\n")
          f.writelines(
              b"# %s\n" % line for line in comment.splitlines()
          )
      X_is_sp = sp.issparse(X)
      y_is_sp = sp.issparse(y)
      if not multilabel and not y_is_sp:
          y = y[:, np.newaxis]
      _dump_svmlight_file(
          X,
          y,
          f,
          multilabel,
          one_based,
          query_id,
          X_is_sp,
          y_is_sp,
      )
  
file_path: scikit-learn/sklearn/datasets/_svmlight_format_io.py
imports: import os.path
  from contextlib import closing
  from numbers import Integral
  import numpy
  import scipy.sparse
  from ..None import __version__
  from ..utils import IS_PYPY, check_array
  from ..utils._param_validation import HasMethods, Interval, StrOptions, validate_params
label_desc: Use image node_id 5 for calling a global function with example usage: _dump_svmlight(X, y, f, multilabel, one_based, comment, query_id) without return types