#NEWLINE# def fake_floating_ip_allocate_address( context , project_id , pool , auto_assigned = False ) : #NEWLINE# #INDENT# ips = [ i for i in floating_ips if ( ( i [ 'fixed_ip_id' ] is None ) and ( i [ 'project_id' ] is None ) and ( i [ 'pool' ] == pool ) ) ] #NEWLINE# if ( not ips ) : #NEWLINE# #INDENT# raise exception . NoMoreFloatingIps ( ) #NEWLINE# #UNINDENT# ips [ 0 ] [ 'project_id' ] = project_id #NEWLINE# ips [ 0 ] [ 'auto_assigned' ] = auto_assigned #NEWLINE# return FakeModel ( ips [ 0 ] )