<s> import nova <EOL> from nova import utils <EOL> from nova import flags <EOL> from nova . image import glance <EOL> FLAGS = flags . FLAGS <EOL> def get_default_image_service ( ) : <EOL> ImageService = utils . import_class ( FLAGS . image_service ) <EOL> return ImageService ( ) <EOL> def get_image_service ( context , image_href ) : <EOL> """<STR_LIT>""" <EOL> image_href = image_href or <NUM_LIT:0> <EOL> if str ( image_href ) . isdigit ( ) : <EOL> return ( get_default_image_service ( ) , int ( image_href ) ) <EOL> ( glance_client , image_id ) = glance . get_glance_client ( context , image_href ) <EOL> image_service = nova . image . glance . GlanceImageService ( glance_client ) <EOL> return ( image_service , image_id ) </s>
