code: def _merge_sorted(
      objs,
      keys=None,
      by_index=False,
      ignore_index=False,
      ascending=True,
      na_position="last",
  ):
      """Merge a list of sorted DataFrame or Series objects.
  
      Dataframes/Series in objs list MUST be pre-sorted by columns
      listed in `keys`, or by the index (if `by_index=True`).
  
      Parameters
      ----------
      objs : list of DataFrame or Series
      keys : list, default None
          List of Column names to sort by. If None, all columns used
          (Ignored if `by_index=True`)
      by_index : bool, default False
          Use index for sorting. `keys` input will be ignored if True
      ignore_index : bool, default False
          Drop and ignore index during merge. Default range index will
          be used in the output dataframe.
      ascending : bool, default True
          Sorting is in ascending order, otherwise it is descending
      na_position : {'first', 'last'}, default 'last'
          'first' nulls at the beginning, 'last' nulls at the end
  
      Returns
      -------
      A new, lexicographically sorted, DataFrame/Series.
      """
      if not pd.api.types.is_list_like(objs):
          raise TypeError(
              "objs must be a list-like of Frame-like objects"
          )
  
      if len(objs) < 1:
          raise ValueError("objs must be non-empty")
  
      if not all(
          isinstance(table, cudf.core.frame.Frame) for table in objs
      ):
          raise TypeError("Elements of objs must be Frame-like")
  
      if len(objs) == 1:
          return objs[0]
  
      if by_index and ignore_index:
          raise ValueError(
              "`by_index` and `ignore_index` cannot both be True"
          )
  
      if by_index:
          key_columns_indices = list(range(0, objs[0]._index.nlevels))
      else:
          if keys is None:
              key_columns_indices = list(range(0, objs[0]._num_columns))
          else:
              key_columns_indices = [
                  objs[0]._column_names.index(key) for key in keys
              ]
          if not ignore_index:
              key_columns_indices = [
                  idx + objs[0]._index.nlevels
                  for idx in key_columns_indices
              ]
  
      columns = [
          [
              *(obj._index._data.columns if not ignore_index else ()),
              *obj._columns,
          ]
          for obj in objs
      ]
  
      return objs[0]._from_columns_like_self(
          cudf._lib.merge.merge_sorted(
              input_columns=columns,
              key_columns_indices=key_columns_indices,
              ascending=ascending,
              na_position=na_position,
          ),
          column_names=objs[0]._column_names,
          index_names=None if ignore_index else objs[0]._index_names,
      )
  
imports: import itertools
  import warnings
  from collections import abc
  from typing import Dict, Optional
  import cupy
  import numpy
  import pandas
  import cudf
  from cudf._lib.transform import one_hot_encode
  from cudf._lib.types import size_type_dtype
  from cudf._typing import Dtype
  from cudf.api.extensions import no_default
  from cudf.core.column import ColumnBase, as_column, column_empty_like
  from cudf.core.column.categorical import CategoricalColumn
  from cudf.utils.dtypes import min_unsigned_type
label_desc: Use image node_id 7 for calling a global function with example usage: _merge_sorted(objs, keys, by_index, ignore_index, ascending, na_position) and returns: objs, objs