code: def to_weld_literal(scalar, weld_type):
      
      try:
          if isinstance(scalar, int):
              if isinstance(weld_type, WeldInt16):
                  return '{}si'.format(str(scalar))
              elif isinstance(weld_type, WeldInt):
                  return str(scalar)
              elif isinstance(weld_type, WeldLong):
                  return '{}L'.format(str(scalar))
              elif isinstance(weld_type, WeldFloat):
                  return '{}f'.format(str(scalar))
              elif isinstance(weld_type, WeldDouble):
                  return '{}.0'.format(str(scalar))
              else:
                  raise TypeError()
          elif isinstance(scalar, float):
              if isinstance(weld_type, WeldFloat):
                  return '{}f'.format(str(scalar))
              elif isinstance(weld_type, WeldDouble):
                  return str(scalar)
              else:
                  raise TypeError()
          elif isinstance(scalar, str):
              if str(weld_type) == 'vec[i8]':
                  return str(scalar)
              else:
                  raise TypeError()
          elif isinstance(scalar, bool):
              if isinstance(weld_type, WeldBit):
                  return str(scalar).lower()
              else:
                  raise TypeError()
          else:
              raise TypeError()
      except TypeError:
          raise TypeError('Cannot convert scalar:{} to type:{}'.format(scalar, weld_type))
docs: Return scalar formatted for Weld.
  
      Parameters
      ----------
      scalar : {int, float, str, bool}
          Scalar data to convert to weld literal.
      weld_type : WeldType
          Desired Weld type.
  
      Returns
      -------
      str
          String of the scalar to use in Weld code.
  
      Examples
      --------
      >>> to_weld_literal(4, WeldLong())
      '4L'