code: def _prepare_merge_sorted_test(
      size,
      nparts,
      keys,
      add_null=False,
      na_position="last",
      ascending=True,
      series=False,
      index=False,
  ):
      if index:
          df = (
              cudf.datasets.timeseries()[:size]
              .reset_index(drop=False)
              .set_index(keys, drop=True)
          )
      else:
          df = cudf.datasets.timeseries()[:size].reset_index(drop=False)
          if add_null:
              df.iloc[1, df.columns.get_loc(keys[0])] = None
      chunk = int(size / nparts)
      indices = [i * chunk for i in range(0, nparts)] + [size]
      if index:
          dfs = [
              df.iloc[indices[i] : indices[i + 1]]
              .copy()
              .sort_index(ascending=ascending)
              for i in range(nparts)
          ]
      elif series:
          df = df[keys[0]]
          dfs = [
              df.iloc[indices[i] : indices[i + 1]]
              .copy()
              .sort_values(na_position=na_position, ascending=ascending)
              for i in range(nparts)
          ]
      else:
          dfs = [
              df.iloc[indices[i] : indices[i + 1]]
              .copy()
              .sort_values(
                  keys, na_position=na_position, ascending=ascending
              )
              for i in range(nparts)
          ]
      return df, dfs
  
imports: import re
  from itertools import chain
  import numpy
  import pandas
  import pytest
  import cudf
  from cudf import melt
  from cudf.core.buffer.spill_manager import get_global_manager
  from cudf.testing._utils import ALL_TYPES, DATETIME_TYPES, NUMERIC_TYPES, assert_eq
label_desc: Use image node_id 10 for calling a global function with example usage: _prepare_merge_sorted_test(size, nparts, keys, add_null, na_position, ascending, series, index) and returns: df,  dfs