def read_device_map(path):
 devices = {}
 with open(path, 'r') as stream:
  for line in stream:
   piece = line.strip().split(',')
   devices[int(piece[0], 16)] = piece[1]
 return devices

def read_device_map ( path ) : devices = { } with open ( path , 'r' ) as stream : for line in stream : piece = line . strip ( ) . split ( ',' ) devices [ int ( piece [ 0 ] , 16 ) ] = piece [ 1 ] return devices
a helper method to read the device path to address mapping from file:: 0x0001 .