Guess the type of a file based on the filename using mimetypes Python module

mime_guess(file)

Arguments

file path

string