Detecting MIME types well is an important feature and we already have mimetypes detection library but AFAIK it is not good enough.
Note that some of our stdlib module already use the sniffing algorithm (e.g imghdr)
The question is how exactly the mime sniffing should be done in terms of file formats and algorithm. Luckily, WHATWG published the standard for mime sniffing, and I think we should follow it. (https://mimesniff.spec.whatwg.org/)
So I created the issue on the bpo and implemented it. I 'd like to listen to all your opinions :)