code: def tosequence(x):
      """Cast iterable x to a Sequence, avoiding a copy if possible."""
      if isinstance(x, np.ndarray):
          return np.asarray(x)
      elif isinstance(x, Sequence):
          return x
      else:
          return list(x)
  
imports: from collections import Sequence
  import numpy
  from scipy.sparse import issparse
  import warnings
  from .murmurhash import murmurhash3_32
  from .validation import as_float_array, assert_all_finite, check_random_state, column_or_1d, check_array, check_consistent_length, check_X_y, indexable, check_symmetric
  from .deprecation import deprecated
  from .class_weight import compute_class_weight, compute_sample_weight
  from ..externals.joblib import cpu_count
  from ..exceptions import ConvergenceWarning
  from ..exceptions import DataConversionWarning
label_desc: Use image node_id 10 for calling a global function with example usage: tosequence(x) and returns: np, x, list