code: def is_scalar(val):
      """Return True if given object is scalar.
  
      Parameters
      ----------
      val : object
          Possibly scalar object.
  
      Returns
      -------
      bool
          Return True if given object is scalar.
      """
      return isinstance(
          val,
          (
              cudf.Scalar,
              cudf._lib.scalar.DeviceScalar,
              cudf.core.tools.datetimes.DateOffset,
          ),
      ) or (
          pd_types.is_scalar(val)
          # Pytorch tensors advertise that they support the number
          # protocol, and therefore return True for PyNumber_Check even
          # when they have a shape. So, if we get through this, let's
          # additionally check that if they have a shape property that
          # it is empty.
          # See https://github.com/pytorch/pytorch/issues/99646
          # and https://github.com/pandas-dev/pandas/issues/52701
          and len(getattr(val, "shape", ())) == 0
      )
  
imports: from __future__ import annotations
  from collections import abc
  from functools import wraps
  from inspect import isclass
  from typing import List, Union
  import cupy
  import numpy
  import pandas
  from pandas.api import types
  import cudf
  from cudf.core._compat import PANDAS_GE_150
  from cudf.core.dtypes import _BaseDtype, dtype, is_categorical_dtype, is_decimal32_dtype, is_decimal64_dtype, is_decimal128_dtype, is_decimal_dtype, is_interval_dtype, is_list_dtype, is_struct_dtype
label_desc: Use image node_id 5 for calling a global function with example usage: is_scalar(val) and returns: unknown