def image_destroy(context, image_id):
 session = get_session()
 with session.begin():
  image_ref = _image_get(context, image_id, session=session)
  check_mutate_authorization(context, image_ref)
  _image_locations_set(image_ref.id, [], session)
  image_ref.delete(session=session)
  for prop_ref in image_ref.properties:
   image_property_delete(context, prop_ref, session=session)
  members = _image_member_find(context, session, image_id=image_id)
  for memb_ref in members:
   _image_member_delete(context, memb_ref, session)
 return _normalize_locations(image_ref)

def image_destroy ( context , image_id ) : session = get_session ( ) with session . begin ( ) : image_ref = _image_get ( context , image_id , session = session ) check_mutate_authorization ( context , image_ref ) _image_locations_set ( image_ref . id , [ ] , session ) image_ref . delete ( session = session ) for prop_ref in image_ref . properties : image_property_delete ( context , prop_ref , session = session ) members = _image_member_find ( context , session , image_id = image_id ) for memb_ref in members : _image_member_delete ( context , memb_ref , session ) return _normalize_locations ( image_ref )
destroy the image or raise if it does not exist .