(filename)
return stdout.decode('ascii')
return the mimetype of the file as string or an error string,
    if the file does not exist or is not accesible.
return the mimetype of the file as string or an error string,
    if the file does not exist or is not accesible.
return the mimetype of the file as string or an error string if the file does not exist or is not accesible .
def mimetype(filename):
    '''return the mimetype of the file as string or an error string,
    if the file does not exist or is not accesible.
    '''
    file = subprocess.Popen(
        ['file', '--brief', '--mime-type', filename],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE
    )
    stdout, stderr = file.communicate()
    if stdout:
        stdout = stdout.strip()
    return stdout.decode('ascii')
def mimetype ( filename ) : file = subprocess . Popen ( [ 'file' , '--brief' , '--mime-type' , filename ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) stdout , stderr = file . communicate ( ) if stdout : stdout = stdout . strip ( ) return stdout . decode ( 'ascii' )