human
Complete the below
def extend(image, size):

    ''''Increase image to size.
    :param image: instance of nova.virt.image.model.Image
    :param size: image size in bytes'
    '''

Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    if (not isinstance(image, imgmodel.LocalImage)):
        return
    if (image.format == imgmodel.FORMAT_PLOOP):
        if (not can_resize_image(image.path, size)):
            return
        utils.execute('prl_disk_tool', 'resize', '--size', ('%dM' % (size // units.Mi)), '--resize_partition', '--hdd', image.path, run_as_root=True)
        return
    if (not can_resize_image(image.path, size)):
        return
    utils.execute('qemu-img', 'resize', image.path, size)
    if ((image.format != imgmodel.FORMAT_RAW) and (not CONF.resize_fs_using_block_device)):
        return
    if (not is_image_extendable(image)):
        return
    def safe_resize2fs(dev, run_as_root=False, finally_call=(lambda : None)):
        try:
            resize2fs(dev, run_as_root=run_as_root, check_exit_code=[0])
        except processutils.ProcessExecutionError as exc:
            LOG.debug('Resizing    the    file    system    with    resize2fs    has    failed    with    error:    %s', exc)
        finally:
            finally_call()
    if (image.format != imgmodel.FORMAT_RAW):
        mounter = mount.Mount.instance_for_format(image, None, None)
        if mounter.get_dev():
            safe_resize2fs(mounter.device, run_as_root=True, finally_call=mounter.unget_dev)
    else:
        safe_resize2fs(image.path)