def isdevice(dev):
 try:
  os.stat(dev)
  return str(dev)
 except OSError:
  raise vol.Invalid('No device found!')

def isdevice ( dev ) : try : os . stat ( dev ) return str ( dev ) except OSError : raise vol . Invalid ( 'No device found!' )
check if dev a real device .