class_docstr: Helper methods to load, save and pre-process data used in MLlib.
  
  .. versionadded:: 1.0.0
docstr: Converts a LabeledPoint to a string in LIBSVM format.
docstr_tok: ["Converts","a","LabeledPoint","to","a","string","in","LIBSVM","format","."]
code: def _convert_labeled_point_to_libsvm(p: "LabeledPoint") -> str:
      """Converts a LabeledPoint to a string in LIBSVM format."""
      from pyspark.mllib.regression import LabeledPoint
  
      assert isinstance(p, LabeledPoint)
      items = [str(p.label)]
      v = _convert_to_vector(p.features)
      if isinstance(v, SparseVector):
          nnz = len(v.indices)
          for i in range(nnz):
              items.append(
                  str(v.indices[i] + 1) + ":" + str(v.values[i])
              )
      else:
          for i in range(len(v)):
              items.append(str(i + 1) + ":" + str(v[i]))  # type: ignore[index]
      return " ".join(items)
  
imports: import sys
  from functools import reduce
  import numpy
  from pyspark import SparkContext, since
  from pyspark.mllib.common import callMLlibFunc, inherit_doc
  from pyspark.mllib.linalg import Vectors, SparseVector, _convert_to_vector
  from pyspark.sql import DataFrame
  from typing import Generic, Iterable, List, Optional, Tuple, Type, TypeVar, cast, TYPE_CHECKING
  from pyspark.context import SparkContext
  from pyspark.mllib.linalg import Vector
  from pyspark.rdd import RDD
  from pyspark.sql.dataframe import DataFrame
label_desc: Use image node_id 2 for calling the MLUtils obj's underlying member method code with example usage: obj._convert_labeled_point_to_libsvm(p) and returns: str