def guess_mimetype(filename):
    fn = os.path.basename(filename)
    return mimetypes.guess_type(fn)[0] or 'application/octet-stream'
Guesses the mimetype of a file, based on the filename
dataset/ETHPy150Open ipfs/py-ipfs-api/ipfsApi/utils.py/guess_mimetype