def METHOD_NAME(self, chip_id, iter_addr_offset_tuples, chunk_size=None):
    of_name = self.generate_binary(0)
    com_args = [mkuf2_path, 'write',
                '-o', of_name,
                '--chip-id', hex(chip_id)]
    com_args += [] if chunk_size is None else ['--chunk-size', str(chunk_size)]
    file_args = list(chain(*[(str(addr), f) for addr, f in iter_addr_offset_tuples]))
    p = pexpect.spawn(sys.executable, com_args + file_args, timeout=20)
    self.addCleanup(p.terminate, force=True)
    exp_list = ['Adding {} at {}'.format(f, hex(addr)) for addr, f in iter_addr_offset_tuples]
    exp_list += ['"{}" has been written.'.format(of_name)]
    for e in exp_list:
        p.expect_exact(e)
    # Do non-blocking wait instead of the blocking p.wait():
    for _ in range(10):
        if not p.isalive():
            break
        time.sleep(0.5)
    # else: will be terminated during cleanup
    return of_name