code: def _pivot(df, index, columns):
      """
      Reorganize the values of the DataFrame according to the given
      index and columns.
  
      Parameters
      ----------
      df : DataFrame
      index : cudf.Index
          Index labels of the result
      columns : cudf.Index
          Column labels of the result
      """
      columns_labels, columns_idx = columns._encode()
      index_labels, index_idx = index._encode()
      column_labels = columns_labels.to_pandas().to_flat_index()
  
      # the result of pivot always has a multicolumn
      result = cudf.core.column_accessor.ColumnAccessor(
          multiindex=True, level_names=(None,) + columns._data.names
      )
  
      def as_tuple(x):
          return x if isinstance(x, tuple) else (x,)
  
      for v in df:
          names = [
              as_tuple(v) + as_tuple(name) for name in column_labels
          ]
          nrows = len(index_labels)
          ncols = len(names)
          num_elements = nrows * ncols
          if num_elements > 0:
              col = df._data[v]
              scatter_map = (columns_idx * np.int32(nrows)) + index_idx
              target = cudf.DataFrame._from_data(
                  {
                      None: cudf.core.column.column_empty_like(
                          col, masked=True, newsize=nrows * ncols
                      )
                  }
              )
              target._data[None][scatter_map] = col
              result_frames = target._split(
                  range(nrows, nrows * ncols, nrows)
              )
              result.update(
                  {
                      name: next(iter(f._columns))
                      for name, f in zip(names, result_frames)
                  }
              )
  
      return cudf.DataFrame._from_data(
          result, index=cudf.Index(index_labels, name=index.name)
      )
  
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 8 for calling a global function with example usage: _pivot(df, index, columns) and returns: cudf, unknown