code: def as_type(type, *args):
      # Convert array args to type supported by
      # CumlArray.to_output ('numpy','cudf','cupy'...)
      # Ensure 2 dimensional inputs are not converted to 1 dimension
      # None remains as None
      # Scalar remains a scalar
      result = []
      for arg in args:
          if arg is None or np.isscalar(arg):
              result.append(arg)
          else:
              # make sure X with a single feature remains 2 dimensional
              if (
                  type in ("cudf", "pandas", "df_obj")
                  and len(arg.shape) > 1
              ):
                  if type == "pandas":
                      mem_type = MemoryType.host
                  else:
                      mem_type = None
                  result.append(
                      input_to_cuml_array(arg).array.to_output(
                          output_type="dataframe",
                          output_mem_type=mem_type,
                      )
                  )
              else:
                  result.append(
                      input_to_cuml_array(arg).array.to_output(type)
                  )
      if len(result) == 1:
          return result[0]
      return tuple(result)
  
imports: import pytest
  from cuml.internals.mem_type import MemoryType
  from cuml.internals.input_utils import input_to_cuml_array, is_array_like
  from cuml.internals.base import Base
  import cuml
  from sklearn.model_selection import train_test_split
  from sklearn.metrics import mean_squared_error, brier_score_loss
  from sklearn.datasets import make_classification, make_regression
  from sklearn import datasets
  from pylibraft.common.cuda import Stream
  from sklearn.datasets import make_regression
  from numba.cuda.cudadrv.devicearray import DeviceNDArray
  from numbers import Number
  from cuml.internals.safe_imports import gpu_only_import_from
  from itertools import dropwhile
  from copy import deepcopy
  from cuml.internals.safe_imports import cpu_only_import
  import inspect
  from textwrap import dedent, indent
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 5 for calling a global function with example usage: as_type(type) and returns: tuple, result