(fn)
return True
Check if ``fn`` is a readable and writable character device.
Check if ``fn`` is a readable and writable character device.
Check if fn is a readable and writable character device .
def is_device(fn):
    '''Check if ``fn`` is a readable and writable character device.'''

    if not os.path.exists(fn):
        return False

    m = os.stat(fn)[stat.ST_MODE]
    if not stat.S_ISCHR(m):
        return False

    if not os.access(fn, os.R_OK | os.W_OK):
        return False

    return True
def is_device ( fn ) : if not os . path . exists ( fn ) : return False m = os . stat ( fn ) [ stat . ST_MODE ] if not stat . S_ISCHR ( m ) : return False if not os . access ( fn , os . R_OK | os . W_OK ) : return False return True