code: def to_lal_type_str(pytype):
      
      # noop
      if pytype in LAL_TYPE_FROM_STR:
          return pytype
  
      # convert type code
      if pytype in LAL_TYPE_STR:
          return LAL_TYPE_STR[pytype]
  
      # convert python type
      try:
          dtype = numpy.dtype(pytype)
          return LAL_TYPE_STR_FROM_NUMPY[dtype.type]
      except (TypeError, KeyError):
          raise ValueError("Failed to map {!r} to LAL type string")
docs: Convert the input python type to a LAL type string
  
      Examples
      --------
      To convert a python type:
  
      >>> from gwpy.utils.lal import to_lal_type_str
      >>> to_lal_type_str(float)
      'REAL8'
  
      To convert a `numpy.dtype`:
  
      >>> import numpy
      >>> to_lal_type_str(numpy.dtype('uint32'))
      'UINT4'
  
      To convert a LAL type code:
  
      >>> to_lal_type_str(11)
      'REAL8'
  
      Raises
      ------
      KeyError
          if the input doesn't map to a LAL type string