def _extract_nexe(program_path, processed_images, command):
    """
    Given a `command`, search through the listed tar images
    (`processed_images`) and extract the nexe matching `command` to the target
    `program_path` on the host file system.

    :param program_path:
        Location (including filename) which specifies the destination of the
        extracted nexe.
    :param processed_images:
        Output of :func:`_process_images`.
    :param command:
        The name of a nexe, such as `python` or `myapp.nexe`.
    """
    with open(program_path, 'w') as program_fp:
        for zvm_image, _, _ in processed_images:
            try:
                tf = tarfile.open(zvm_image)
                nexe_fp = tf.extractfile(command)
                # once we've found the nexe the user wants to run,
                # we're done
                program_fp.write(nexe_fp.read())
                return program_path
            except __HOLE__:
                # program not found in this image,
                # go to the next and keep searching
                pass
            finally:
                tf.close()
dataset/ETHPy150Open zerovm/zerovm-cli/zvshlib/zvsh.py/_extract_nexe