code: def rand_dataframe(
      dtypes_meta,
      rows,
      seed=random.randint(0, 2**32 - 1),
      use_threads=True,
  ):
      """
      Generates a random table.
  
      Parameters
      ----------
      dtypes_meta : List of dict
          Specifies list of dtype meta data. dtype meta data should
          be a dictionary of the form example:
              {"dtype": "int64", "null_frequency": 0.4, "cardinality": 10}
          `"str"` dtype can contain an extra key `max_string_length` to
          control the maximum size of the strings being generated in each row.
          If not specified, it will default to 1000.
      rows : int
          Specifies the number of rows to be generated.
      seed : int
          Specifies the `seed` value to be utilized by all downstream
          random data generation APIs.
      use_threads : bool
          Indicates whether to use threads pools to build the columns
  
      Returns
      -------
      PyArrow Table
          A Table with columns of corresponding dtypes mentioned in `dtypes_meta`
      """
      # Apply seed
      random.seed(seed)
      np.random.seed(seed)
  
      column_params = []
      for meta in dtypes_meta:
          dtype = copy.deepcopy(meta["dtype"])
          null_frequency = copy.deepcopy(meta["null_frequency"])
          cardinality = copy.deepcopy(meta["cardinality"])
  
          if dtype == "list":
              lists_max_length = meta["lists_max_length"]
              nesting_max_depth = meta["nesting_max_depth"]
              value_type = meta["value_type"]
              nesting_depth = np.random.randint(1, nesting_max_depth)
  
              dtype = cudf.core.dtypes.ListDtype(value_type)
  
              # Determining the `dtype` from the `value_type`
              # and the nesting_depth
              i = 1
              while i < nesting_depth:
                  dtype = cudf.core.dtypes.ListDtype(dtype)
                  i += 1
  
              column_params.append(
                  ColumnParameters(
                      cardinality=cardinality,
                      null_frequency=null_frequency,
                      generator=list_generator(
                          dtype=value_type,
                          size=cardinality,
                          nesting_depth=nesting_depth,
                          lists_max_length=lists_max_length,
                      ),
                      is_sorted=False,
                      dtype=dtype,
                  )
              )
          elif dtype == "struct":
              nesting_max_depth = meta["nesting_max_depth"]
              max_types_at_each_level = meta["max_types_at_each_level"]
              max_null_frequency = meta["max_null_frequency"]
              nesting_depth = np.random.randint(1, nesting_max_depth)
              structDtype = create_nested_struct_type(
                  max_types_at_each_level=max_types_at_each_level,
                  nesting_level=nesting_depth,
              )
  
              column_params.append(
                  ColumnParameters(
                      cardinality=cardinality,
                      null_frequency=null_frequency,
                      generator=struct_generator(
                          dtype=structDtype,
                          cardinality=cardinality,
                          size=rows,
                          max_null_frequency=max_null_frequency,
                      ),
                      is_sorted=False,
                      dtype=structDtype,
                  )
              )
          elif dtype == "decimal64":
              max_precision = meta.get(
                  "max_precision", cudf.Decimal64Dtype.MAX_PRECISION
              )
              precision = np.random.randint(1, max_precision)
              scale = np.random.randint(0, precision)
              dtype = cudf.Decimal64Dtype(
                  precision=precision, scale=scale
              )
              column_params.append(
                  ColumnParameters(
                      cardinality=cardinality,
                      null_frequency=null_frequency,
                      generator=decimal_generator(
                          dtype=dtype, size=cardinality
                      ),
                      is_sorted=False,
                      dtype=dtype,
                  )
              )
          elif dtype == "decimal32":
              max_precision = meta.get(
                  "max_precision", cudf.Decimal32Dtype.MAX_PRECISION
              )
              precision = np.random.randint(1, max_precision)
              scale = np.random.randint(0, precision)
              dtype = cudf.Decimal32Dtype(
                  precision=precision, scale=scale
              )
              column_params.append(
                  ColumnParameters(
                      cardinality=cardinality,
                      null_frequency=null_frequency,
                      generator=decimal_generator(
                          dtype=dtype, size=cardinality
                      ),
                      is_sorted=False,
                      dtype=dtype,
                  )
              )
          elif dtype == "decimal128":
              max_precision = meta.get(
                  "max_precision", cudf.Decimal128Dtype.MAX_PRECISION
              )
              precision = np.random.randint(1, max_precision)
              scale = np.random.randint(0, precision)
              dtype = cudf.Decimal128Dtype(
                  precision=precision, scale=scale
              )
              column_params.append(
                  ColumnParameters(
                      cardinality=cardinality,
                      null_frequency=null_frequency,
                      generator=decimal_generator(
                          dtype=dtype, size=cardinality
                      ),
                      is_sorted=False,
                      dtype=dtype,
                  )
              )
          elif dtype == "category":
              column_params.append(
                  ColumnParameters(
                      cardinality=cardinality,
                      null_frequency=null_frequency,
                      generator=lambda cardinality=cardinality: [
                          _unique_string() for _ in range(cardinality)
                      ],
                      is_sorted=False,
                      dtype="category",
                  )
              )
          else:
              dtype = cudf.dtype(dtype)
              if dtype.kind in ("i", "u"):
                  column_params.append(
                      ColumnParameters(
                          cardinality=cardinality,
                          null_frequency=null_frequency,
                          generator=int_generator(
                              dtype=dtype,
                              size=cardinality,
                              min_bound=meta.get("min_bound", None),
                              max_bound=meta.get("max_bound", None),
                          ),
                          is_sorted=False,
                          dtype=dtype,
                      )
                  )
              elif dtype.kind == "f":
                  column_params.append(
                      ColumnParameters(
                          cardinality=cardinality,
                          null_frequency=null_frequency,
                          generator=float_generator(
                              dtype=dtype,
                              size=cardinality,
                              min_bound=meta.get("min_bound", None),
                              max_bound=meta.get("max_bound", None),
                          ),
                          is_sorted=False,
                          dtype=dtype,
                      )
                  )
              elif dtype.kind in ("U", "O"):
                  column_params.append(
                      ColumnParameters(
                          cardinality=cardinality,
                          null_frequency=null_frequency,
                          generator=lambda cardinality=cardinality: [
                              _generate_string(
                                  string.printable,
                                  np.random.randint(
                                      low=0,
                                      high=meta.get(
                                          "max_string_length", 1000
                                      ),
                                      size=1,
                                  )[0],
                              )
                              for _ in range(cardinality)
                          ],
                          is_sorted=False,
                          dtype=dtype,
                      )
                  )
              elif dtype.kind == "M":
                  column_params.append(
                      ColumnParameters(
                          cardinality=cardinality,
                          null_frequency=null_frequency,
                          generator=datetime_generator(
                              dtype=dtype,
                              size=cardinality,
                              min_bound=meta.get("min_bound", None),
                              max_bound=meta.get("max_bound", None),
                          ),
                          is_sorted=False,
                          dtype=cudf.dtype(dtype),
                      )
                  )
              elif dtype.kind == "m":
                  column_params.append(
                      ColumnParameters(
                          cardinality=cardinality,
                          null_frequency=null_frequency,
                          generator=timedelta_generator(
                              dtype=dtype,
                              size=cardinality,
                              min_bound=meta.get("min_bound", None),
                              max_bound=meta.get("max_bound", None),
                          ),
                          is_sorted=False,
                          dtype=cudf.dtype(dtype),
                      )
                  )
              elif dtype.kind == "b":
                  column_params.append(
                      ColumnParameters(
                          cardinality=cardinality,
                          null_frequency=null_frequency,
                          generator=boolean_generator(cardinality),
                          is_sorted=False,
                          dtype=cudf.dtype(dtype),
                      )
                  )
              else:
                  raise TypeError(f"Unsupported dtype: {dtype}")
              # TODO: Add List column support once
              # https://github.com/rapidsai/cudf/pull/6075
              # is merged.
  
      df = get_dataframe(
          Parameters(
              num_rows=rows,
              column_parameters=column_params,
              seed=seed,
          ),
          use_threads=use_threads,
      )
  
      return df
  
imports: import copy
  import random
  import string
  import uuid
  from multiprocessing import Pool
  import numpy
  import pandas
  import pyarrow
  from pyarrow import parquet
  import cudf
  from cudf.utils.dtypes import np_to_pa_dtype
label_desc: Use image node_id 5 for calling a global function with example usage: rand_dataframe(dtypes_meta, rows, seed, use_threads) and returns: df