code: def get_extension(media):
      
  
      # Photos are always compressed as .jpg by Telegram
      if isinstance(media, (types.UserProfilePhoto,
                            types.ChatPhoto, types.MessageMediaPhoto)):
          return '.jpg'
  
      # Documents will come with a mime type
      if isinstance(media, types.MessageMediaDocument):
          media = media.document
      if isinstance(media, (
              types.Document, types.WebDocument, types.WebDocumentNoProxy)):
          if media.mime_type == 'application/octet-stream':
              # Octet stream are just bytes, which have no default extension
              return ''
          else:
              return guess_extension(media.mime_type) or ''
  
      return ''
docs: Gets the corresponding extension for any Telegram media.