#NEWLINE# def preconfigure_instance( session , instance , vdi_ref , network_info ) : #NEWLINE# #INDENT# 'Makes alterations to the image before launching as part of spawn.\n    ' #NEWLINE# key = str ( instance [ 'key_data' ] ) #NEWLINE# net = netutils . get_injected_network_template ( network_info ) #NEWLINE# metadata = instance [ 'metadata' ] #NEWLINE# mount_required = ( key or net or metadata ) #NEWLINE# if ( not mount_required ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# with vdi_attached_here ( session , vdi_ref , read_only = False ) as dev : #NEWLINE# #INDENT# _mounted_processing ( dev , key , net , metadata )