class_docstr: A GPU-backed scalar object with NumPy scalar like properties
  May be used in binary operations against other scalars, cuDF
  Series, DataFrame, and Index objects.
  
  Examples
  --------
  >>> import cudf
  >>> cudf.Scalar(42, dtype='int64')
  Scalar(42, dtype=int64)
  >>> cudf.Scalar(42, dtype='int32') + cudf.Scalar(42, dtype='float64')
  Scalar(84.0, dtype=float64)
  >>> cudf.Scalar(42, dtype='int64') + np.int8(21)
  Scalar(63, dtype=int64)
  >>> x = cudf.Scalar(42, dtype='datetime64[s]')
  >>> y = cudf.Scalar(21, dtype='timedelta64[ns]')
  >>> x - y
  Scalar(1970-01-01T00:00:41.999999979, dtype=datetime64[ns])
  >>> cudf.Series([1,2,3]) + cudf.Scalar(1)
  0    2
  1    3
  2    4
  dtype: int64
  >>> df = cudf.DataFrame({'a':[1,2,3], 'b':[4.5, 5.5, 6.5]})
  >>> slr = cudf.Scalar(10, dtype='uint8')
  >>> df - slr
     a    b
  0 -9 -5.5
  1 -8 -4.5
  2 -7 -3.5
  
  Parameters
  ----------
  value : Python Scalar, NumPy Scalar, or cuDF Scalar
      The scalar value to be converted to a GPU backed scalar object
  dtype : np.dtype or string specifier
      The data type
class_docstr_tok: ["A","GPU-backed","scalar","object","with","NumPy","scalar","like","properties","May","be","used","in","binary","operations","against","other","scalars",",","cuDF","Series",",","DataFrame",",","and","Index","objects",".","Examples","--","--","--","--",">",">",">","import","cudf",">",">",">","cudf.Scalar","(","42",",","dtype='int64","'",")","Scalar","(","42",",","dtype=int64",")",">",">",">","cudf.Scalar","(","42",",","dtype='int32","'",")","+","cudf.Scalar","(","42",",","dtype='float64","'",")","Scalar","(","84.0",",","dtype=float64",")",">",">",">","cudf.Scalar","(","42",",","dtype='int64","'",")","+","np.int8","(","21",")","Scalar","(","63",",","dtype=int64",")",">",">",">","x","=","cudf.Scalar","(","42",",","dtype='datetime64","[","s","]","'",")",">",">",">","y","=","cudf.Scalar","(","21",",","dtype='timedelta64","[","ns","]","'",")",">",">",">","x","-","y","Scalar","(","1970-01-01T00:00:41.999999979",",","dtype=datetime64","[","ns","]",")",">",">",">","cudf.Series","(","[","1,2,3","]",")","+","cudf.Scalar","(","1",")","0","2","1","3","2","4","dtype",":","int64",">",">",">","df","=","cudf.DataFrame","(","{","'","a","'",":","[","1,2,3","]",",","'","b","'",":","[","4.5",",","5.5",",","6.5","]","}",")",">",">",">","slr","=","cudf.Scalar","(","10",",","dtype='uint8","'",")",">",">",">","df","-","slr","a","b","0","-9","-5.5","1","-8","-4.5","2","-7","-3.5","Parameters","--","--","--","--","--","value",":","Python","Scalar",",","NumPy","Scalar",",","or","cuDF","Scalar","The","scalar","value","to","be","converted","to","a","GPU","backed","scalar","object","dtype",":","np.dtype","or","string","specifier","The","data","type"]
code: def _preprocess_host_value(self, value, dtype):
      valid = not cudf._lib.scalar._is_null_host_scalar(value)
  
      if isinstance(value, list):
          if dtype is not None:
              raise TypeError(
                  "Lists may not be cast to a different dtype"
              )
          else:
              dtype = ListDtype.from_arrow(
                  pa.infer_type([value], from_pandas=True)
              )
              return value, dtype
      elif isinstance(dtype, ListDtype):
          if value not in {None, NA}:
              raise ValueError(f"Can not coerce {value} to ListDtype")
          else:
              return NA, dtype
  
      if isinstance(value, dict):
          if dtype is None:
              dtype = StructDtype.from_arrow(
                  pa.infer_type([value], from_pandas=True)
              )
          return value, dtype
      elif isinstance(dtype, StructDtype):
          if value not in {None, NA}:
              raise ValueError(f"Can not coerce {value} to StructDType")
          else:
              return NA, dtype
  
      if isinstance(dtype, cudf.core.dtypes.DecimalDtype):
          value = pa.scalar(
              value, type=pa.decimal128(dtype.precision, dtype.scale)
          ).as_py()
      if isinstance(value, decimal.Decimal) and dtype is None:
          dtype = cudf.Decimal128Dtype._from_decimal(value)
  
      value = to_cudf_compatible_scalar(value, dtype=dtype)
  
      if dtype is None:
          if not valid:
              if isinstance(value, (np.datetime64, np.timedelta64)):
                  unit, _ = np.datetime_data(value)
                  if unit == "generic":
                      raise TypeError(
                          "Cant convert generic NaT to null scalar"
                      )
                  else:
                      dtype = value.dtype
              else:
                  raise TypeError(
                      "dtype required when constructing a null scalar"
                  )
          else:
              dtype = value.dtype
  
      if not isinstance(dtype, cudf.core.dtypes.DecimalDtype):
          dtype = cudf.dtype(dtype)
  
      if not valid:
          value = (
              NaT
              if is_datetime64_dtype(dtype)
              or is_timedelta64_dtype(dtype)
              else NA
          )
  
      return value, dtype
  
imports: import decimal
  import operator
  from collections import OrderedDict
  import numpy
  import pyarrow
  import cudf
  from cudf.api.types import is_datetime64_dtype, is_scalar, is_timedelta64_dtype
  from cudf.core.dtypes import ListDtype, StructDtype
  from cudf.core.missing import NA, NaT
  from cudf.core.mixins import BinaryOperand
  from cudf.utils.dtypes import get_allowed_combinations_for_operator, to_cudf_compatible_scalar
label_desc: Use image node_id 10 for calling the Scalar obj's underlying member method code with example usage: obj._preprocess_host_value(value, dtype) and returns: value,  dtype, value,  dtype, value,  dtype, NA,  dtype, NA,  dtype