def raise_http_conflict_for_instance_invalid_state(exc, action, server_id):
 attr = exc.kwargs.get('attr')
 state = exc.kwargs.get('state')
 if ((attr is not None) and (state is not None)):
  msg = (_("Cannot '%(action)s' instance %(server_id)s while it is in %(attr)s %(state)s") % {'action': action, 'attr': attr, 'state': state, 'server_id': server_id})
 else:
  msg = (_("Instance %(server_id)s is in an invalid state for '%(action)s'") % {'action': action, 'server_id': server_id})
 raise webob.exc.HTTPConflict(explanation=msg)

def raise_http_conflict_for_instance_invalid_state ( exc , action , server_id ) : attr = exc . kwargs . get ( 'attr' ) state = exc . kwargs . get ( 'state' ) if ( ( attr is not None ) and ( state is not None ) ) : msg = ( _ ( "Cannot '%(action)s' instance %(server_id)s while it is in %(attr)s %(state)s" ) % { 'action' : action , 'attr' : attr , 'state' : state , 'server_id' : server_id } ) else : msg = ( _ ( "Instance %(server_id)s is in an invalid state for '%(action)s'" ) % { 'action' : action , 'server_id' : server_id } ) raise webob . exc . HTTPConflict ( explanation = msg )
return a webob .