code: def pivot(data, index=None, columns=None, values=None):
      """
      Return reshaped DataFrame organized by the given index and column values.
  
      Reshape data (produce a "pivot" table) based on column values. Uses
      unique values from specified `index` / `columns` to form axes of the
      resulting DataFrame.
  
      Parameters
      ----------
      index : column name, optional
          Column used to construct the index of the result.
      columns : column name, optional
          Column used to construct the columns of the result.
      values : column name or list of column names, optional
          Column(s) whose values are rearranged to produce the result.
          If not specified, all remaining columns of the DataFrame
          are used.
  
      Returns
      -------
      DataFrame
  
      Examples
      --------
      >>> a = cudf.DataFrame()
      >>> a['a'] = [1, 1, 2, 2]
      >>> a['b'] = ['a', 'b', 'a', 'b']
      >>> a['c'] = [1, 2, 3, 4]
      >>> a.pivot(index='a', columns='b')
         c
      b  a  b
      a
      1  1  2
      2  3  4
  
      Pivot with missing values in result:
  
      >>> a = cudf.DataFrame()
      >>> a['a'] = [1, 1, 2]
      >>> a['b'] = [1, 2, 3]
      >>> a['c'] = ['one', 'two', 'three']
      >>> a.pivot(index='a', columns='b')
                c
          b     1     2      3
          a
          1   one   two   <NA>
          2  <NA>  <NA>  three
  
      """
      df = data
      values_is_list = True
      if values is None:
          values = df._columns_view(
              col
              for col in df._column_names
              if col not in (index, columns)
          )
      else:
          if not isinstance(values, (list, tuple)):
              values = [values]
              values_is_list = False
          values = df._columns_view(values)
      if index is None:
          index = df.index
      else:
          index = cudf.core.index.Index(df.loc[:, index])
      columns = cudf.Index(df.loc[:, columns])
  
      # Create a DataFrame composed of columns from both
      # columns and index
      columns_index = {}
      columns_index = {
          i: col
          for i, col in enumerate(
              itertools.chain(
                  index._data.columns, columns._data.columns
              )
          )
      }
      columns_index = cudf.DataFrame(columns_index)
  
      # Check that each row is unique:
      if len(columns_index) != len(columns_index.drop_duplicates()):
          raise ValueError(
              "Duplicate index-column pairs found. Cannot reshape."
          )
  
      result = _pivot(values, index, columns)
  
      # MultiIndex to Index
      if not values_is_list:
          result._data.droplevel(0)
  
      return result
  
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 9 for calling a global function with example usage: pivot(data, index, columns, values) and returns: result