code: def _to_object_array(sequence):
      """Convert sequence to a 1-D NumPy array of object dtype.
  
      numpy.array constructor has a similar use but it's output
      is ambiguous. It can be 1-D NumPy array of object dtype if
      the input is a ragged array, but if the input is a list of
      equal length arrays, then the output is a 2D numpy.array.
      _to_object_array solves this ambiguity by guarantying that
      the output is a 1-D NumPy array of objects for any input.
  
      Parameters
      ----------
      sequence : array-like of shape (n_elements,)
          The sequence to be converted.
  
      Returns
      -------
      out : ndarray of shape (n_elements,), dtype=object
          The converted sequence into a 1-D NumPy array of object dtype.
  
      Examples
      --------
      >>> import numpy as np
      >>> from sklearn.utils import _to_object_array
      >>> _to_object_array([np.array([0]), np.array([1])])
      array([array([0]), array([1])], dtype=object)
      >>> _to_object_array([np.array([0]), np.array([1, 2])])
      array([array([0]), array([1, 2])], dtype=object)
      >>> _to_object_array([np.array([0]), np.array([1, 2])])
      array([array([0]), array([1, 2])], dtype=object)
      """
      out = np.empty(len(sequence), dtype=object)
      out[:] = sequence
      return out
  
imports: import math
  import numbers
  import platform
  import struct
  import timeit
  import warnings
  from collections.abc import Sequence
  from contextlib import contextmanager, suppress
  from itertools import compress, islice
  import numpy
  from scipy.sparse import issparse
  from ..None import get_config
  from ..exceptions import DataConversionWarning
  from .None import _joblib, metadata_routing
  from ._bunch import Bunch
  from ._estimator_html_repr import estimator_html_repr
  from ._param_validation import Integral, Interval, validate_params
  from .class_weight import compute_class_weight, compute_sample_weight
  from .deprecation import deprecated
  from .discovery import all_estimators
  from .fixes import parse_version, threadpool_info
  from .murmurhash import murmurhash3_32
  from .validation import _is_arraylike_not_scalar, _is_pandas_df, _is_polars_df, _use_interchange_protocol, as_float_array, assert_all_finite, check_array, check_consistent_length, check_random_state, check_scalar, check_symmetric, check_X_y, column_or_1d, indexable
label_desc: Use image node_id 21 for calling a global function with example usage: _to_object_array(sequence) and returns: out