'Create a new image.
:param image_name: String used to name the image
:param container_format: Container format of image.
Acceptable formats: ami, ari, aki, bare, ovf, ova and docker.
:param image_location: image file location used to upload
:param disk_format: Disk format of image. Acceptable formats:
ami, ari, aki, vhd, vhdx, vmdk, raw, qcow2, vdi, and iso.
:param **kwargs:  optional parameters to create image
returns: object of image'

@atomic.action_timer('glance.create_image_label')
def _create_image(self, image_name, container_format, image_location, disk_format, **kwargs):

    kw = {'name': image_name, 'container_format': container_format, 'disk_format': disk_format}
    kw.update(kwargs)
    try:
        if os.path.isfile(os.path.expanduser(image_location)):
            kw['data'] = open(os.path.expanduser(image_location))
        else:
            kw['copy_from'] = image_location
        image = self.clients('glance').images.create(**kw)
        image = utils.wait_for(image, is_ready=utils.resource_is('active'), update_resource=utils.get_from_manager(), timeout=100, check_interval=0.5)
    finally:
        if ('data' in kw):
            kw['data'].close()
    return image
