#NEWLINE# def set_machine_maintenance_state( self , name_or_id , state = True , reason = None ) : #NEWLINE# #INDENT# 'Set Baremetal Machine Maintenance State\n\n        Sets Baremetal maintenance state and maintenance reason.\n\n        :param string name_or_id: The Name or UUID value representing the\n                                  baremetal node.\n        :param boolean state: The desired state of the node.  True being in\n                              maintenance where as False means the machine\n                              is not in maintenance mode.  This value\n                              defaults to True if not explicitly set.\n        :param string reason: An optional freeform string that is supplied to\n                              the baremetal API to allow for notation as to why\n                              the node is in maintenance state.\n\n        :raises: OpenStackCloudException on operation error.\n\n        :returns: None\n        ' #NEWLINE# with _utils . shade_exceptions ( 'Error setting machine maintenance state to {state} on node {node}' . format ( state = state , node = name_or_id ) ) : #NEWLINE# #INDENT# if name_or_id : #NEWLINE# #INDENT# result = self . manager . submitTask ( _tasks . MachineSetMaintenance ( node_id = name_or_id , state = 'true' , maint_reason = reason ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = self . manager . submitTask ( _tasks . MachineSetMaintenance ( node_id = name_or_id , state = 'false' ) ) #NEWLINE# #UNINDENT# if ( result is not None ) : #NEWLINE# #INDENT# raise OpenStackCloudException ( ( 'Failed setting machine maintenance state to %s on node %s. Received: %s' % ( state , name_or_id , result ) ) ) #NEWLINE# #UNINDENT# return None