code: def is_image(file):
      
      match = re.match(r'\.(png|jpe?g)', _get_extension(file), re.IGNORECASE)
      if match:
          return True
      else:
          return isinstance(resolve_bot_file_id(file), types.Photo)
docs: Returns ``True`` if the file extension looks like an image file to Telegram.