def guess_content_type(filename, default='application/octet-stream'):
 if filename:
  return (mimetypes.guess_type(filename)[0] or default)
 return default

def guess_content_type ( filename , default = 'application/octet-stream' ) : if filename : return ( mimetypes . guess_type ( filename ) [ 0 ] or default ) return default
given a filename .