docs: def weld_cast_scalar(scalar, to_weld_type):
      """Returns the scalar casted to the request Weld type.
  
      Parameters
      ----------
      scalar : {int, float, WeldObject}
          Input array.
      to_weld_type : WeldType
          Type of each element in the input array.
  
      Returns
      -------
      WeldObject
          Representation of this computation.
  
      """
      if _not_possible_to_cast(scalar, to_weld_type):
          raise TypeError('Cannot cast scalar of type={} to type={}'.format(type(scalar), to_weld_type))
  
      weld_obj = create_empty_weld_object()
      if isinstance(scalar, WeldObject):
          scalar = get_weld_obj_id(weld_obj, scalar)
  
      weld_template = '{type}({scalar})'
  
      weld_obj.weld_code = weld_template.format(scalar=scalar,
                                                type=to_weld_type)
  
      return weld_obj