docs: def to_image_type(image_type):
      '''
      to_image_type(image_type) yields an image-type class equivalent to the given image_type
        argument, which may be a type name or alias or an image or header object or class.    
      '''
      if image_type is None: return None
      if isinstance(image_type, type) and issubclass(image_type, ImageType): return image_type
      if pimms.is_str(image_type):
          image_type = image_type.lower()
          if image_type in image_types_by_name: return image_types_by_name[image_type]
          for it in image_types:
              if image_type in it.aliases(): return it
          raise ValueError('"%s" is not a valid image-type name or alias' % image_type)
      for x in (image_type, type(image_type)):
          try:    return image_types_by_image_type[x]
          except Exception: pass
          try:    return image_types_by_header_type[x]
          except Exception: pass
      raise ValueError('Unsupported image type: %s' % image_type)