def import_image(image_path, os_version):
    """Import image.

    Input parameters:
    :image_path:      Image file path
    :os_version:      Operating system version. e.g. rhel7.2
    """
    image_name = os.path.basename(image_path)
    print("Checking if image %s exists or not, import it if not exists" %
          image_name)
    image_info = sdk_client.send_request('image_query', imagename=image_name)
    if 'overallRC' in image_info and image_info['overallRC']:
        print("Importing image %s ..." % image_name)
        url = 'file://' + image_path
        ret = sdk_client.send_request('image_import', image_name, url,
                                {'os_version': os_version})
    else:
        print("Image %s already exists" % image_name)
Import image.

    Input parameters:
    :image_path:      Image file path
    :os_version:      Operating system version. e.g. rhel7.2