code: def _safe_assign(X, values, *, row_indexer=None, column_indexer=None):
      """Safe assignment to a numpy array, sparse matrix, or pandas dataframe.
  
      Parameters
      ----------
      X : {ndarray, sparse-matrix, dataframe}
          Array to be modified. It is expected to be 2-dimensional.
  
      values : ndarray
          The values to be assigned to `X`.
  
      row_indexer : array-like, dtype={int, bool}, default=None
          A 1-dimensional array to select the rows of interest. If `None`, all
          rows are selected.
  
      column_indexer : array-like, dtype={int, bool}, default=None
          A 1-dimensional array to select the columns of interest. If `None`, all
          columns are selected.
      """
      row_indexer = (
          slice(None, None, None)
          if row_indexer is None
          else row_indexer
      )
      column_indexer = (
          slice(None, None, None)
          if column_indexer is None
          else column_indexer
      )
  
      if hasattr(X, "iloc"):  # pandas dataframe
          with warnings.catch_warnings():
              # pandas >= 1.5 raises a warning when using iloc to set values in a column
              # that does not have the same type as the column being set. It happens
              # for instance when setting a categorical column with a string.
              # In the future the behavior won't change and the warning should disappear.
              # TODO(1.3): check if the warning is still raised or remove the filter.
              warnings.simplefilter("ignore", FutureWarning)
              X.iloc[row_indexer, column_indexer] = values
      else:  # numpy array or sparse matrix
          X[row_indexer, column_indexer] = values
  
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 10 for calling a global function with example usage: _safe_assign(X, values) without return types