import os def file_type(file_path, allowed_extensions=['pdf', 'pptx', 'docx']): _, extension = os.path.splitext(file_path) extension = extension.lower()[1:] # Remove the dot and convert to lowercase if extension in allowed_extensions: return extension # If neither MIME type nor extension match, return None return None