#NEWLINE# def save( path , obj ) : #NEWLINE# #INDENT# 'saves the farmer state to disk\n\n    :param path: the path to save to\n    :param obj: the object to save (must be json serializable)\n    ' #NEWLINE# ( head , tail ) = os . path . split ( path ) #NEWLINE# if ( ( len ( head ) > 0 ) and ( not os . path . isdir ( head ) ) ) : #NEWLINE# #INDENT# os . mkdir ( head ) #NEWLINE# #UNINDENT# with open ( path , 'w+' ) as f : #NEWLINE# #INDENT# json . dump ( obj , f )