code: def ensure_dataframe_type(obj: t.Any) -> pd.DataFrame:
      """Ensure that given object is of type DataFrame or Dataset and return it as DataFrame. else raise error.
  
      Parameters
      ----------
      obj : t.Any
          Object to ensure it is DataFrame or Dataset
      Returns
      -------
      pd.DataFrame
      """
      if isinstance(obj, pd.DataFrame):
          return obj
      elif isinstance(obj, tabular.Dataset):
          return obj.data
      else:
          raise errors.DeepchecksValueError(
              f"dataset must be of type DataFrame or Dataset, but got: {type(obj).__name__}"
          )
  
file_path: deepchecks/deepchecks/tabular/utils/validation.py
imports: import typing
  import numpy
  import pandas
  from deepchecks import tabular
  from deepchecks.core import errors
  from deepchecks.utils.typing import BasicModel
label_desc: Use image node_id 3 for calling a global function with example usage: ensure_dataframe_type(obj) and returns: obj, obj