code: def make_safe_gpu_dataframes(X, y, engine):
      def safe_cudf(X, y):
          # remove duplicate columns
          if len(X.columns) != len(set(X.columns)):
              X = X.loc[:, ~X.columns.duplicated()]
          try:
              y = y.loc[:, ~y.columns.duplicated()]
          except:
              pass
          new_kwargs = {}
          kwargs = {"X": X, "y": y}
          for key, value in kwargs.items():
              if isinstance(value, cudf.DataFrame) and engine in [
                  "pandas",
                  "umap_learn",
                  "dirty_cat",
              ]:
                  new_kwargs[key] = value.to_pandas()
              elif isinstance(value, pd.DataFrame) and engine in [
                  "cuml",
                  "cu_cat",
              ]:
                  new_kwargs[key] = cudf.from_pandas(value)
              else:
                  new_kwargs[key] = value
          return new_kwargs["X"], new_kwargs["y"]
  
      has_cudf_dependancy_, _, cudf = lazy_cudf_import_has_dependancy()
      if has_cudf_dependancy_:
          return safe_cudf(X, y)
      else:
          return X, y
  
imports: import copy
  from time import time
  from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union
  from inspect import getmodule
  import pandas
  from .None import constants
  from .constants import CUML, UMAP_LEARN
  from .feature_utils import FeatureMixin, Literal, XSymbolic, YSymbolic, prune_weighted_edges_df_and_relabel_nodes, resolve_feature_engine
  from .PlotterBase import Plottable, WeakValueDictionary
  from .util import check_set_memoize
  import logging
label_desc: Use image node_id 8 for calling a global function with example usage: make_safe_gpu_dataframes(X, y, engine) and returns: new_kwargs,  new_kwargs, safe_cudf, X,  y