#NEWLINE# def set_active( self , username , active_state ) : #NEWLINE# #INDENT# 'Set the active state of a user\n\n        Args:\n            username: The account username\n            active_state: True or False\n\n        Returns:\n            True: If successful\n            None: If no user or failure occurred\n        ' #NEWLINE# if ( active_state not in ( True , False ) ) : #NEWLINE# #INDENT# raise ValueError ( 'active_state must be True or False' ) #NEWLINE# #UNINDENT# user = self . get_user ( username ) #NEWLINE# if ( user is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( user [ 'active' ] is active_state ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# user [ 'active' ] = active_state #NEWLINE# response = self . _put ( ( self . rest_url + '/user' ) , params = { #NEWLINE# #INDENT# 'username' : self , #NEWLINE# #UNINDENT# } , data = json . dumps ( user ) ) #NEWLINE# if ( response . status_code == 204 ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# return None