code: def test_typecast_to_from_decimal(data, from_dtype, to_dtype):
      if from_dtype.scale > to_dtype.MAX_PRECISION:
          pytest.skip(
              "This is supposed to overflow because the representation value in "
              "the source exceeds the max representable in destination dtype."
          )
      s = data.astype(from_dtype)
  
      pa_arr = s.to_arrow().cast(
          pa.decimal128(to_dtype.precision, to_dtype.scale), safe=False
      )
      if isinstance(to_dtype, Decimal32Dtype):
          expected = cudf.Series(Decimal32Column.from_arrow(pa_arr))
      elif isinstance(to_dtype, Decimal64Dtype):
          expected = cudf.Series(Decimal64Column.from_arrow(pa_arr))
  
      with expect_warning_if(
          to_dtype.scale < s.dtype.scale, UserWarning
      ):
          got = s.astype(to_dtype)
  
      assert_eq(got, expected)
  
imports: import decimal
  from decimal import Decimal
  import numpy
  import pyarrow
  import pytest
  from packaging import version
  import cudf
  from cudf.core.column import Decimal32Column, Decimal64Column, NumericalColumn
  from cudf.core.dtypes import Decimal32Dtype, Decimal64Dtype
  from cudf.testing._utils import FLOAT_TYPES, INTEGER_TYPES, SIGNED_TYPES, _decimal_series, assert_eq, expect_warning_if
label_desc: Use image node_id 7 for calling a global function with example usage: test_typecast_to_from_decimal(data, from_dtype, to_dtype) without return types