we can avoid all this logic of multiple IFs usng the next line:
type_image.lower().replace(".", "")