def METHOD_NAME(self, addr, val):
    """reg_write writes val to the addr in the regmap"""
    for range_dict in self.ranges:
        if range_dict['min'] <= addr <= range_dict['max']:
            break
    else:
        sys.exit("bad write address")
    with open(self.registers_path, 'rb+') as _file:
        _file.write("{:x} {:x}".format(addr, val).encode())