#NEWLINE# def obj2dict( obj , classkey = None ) : #NEWLINE# #INDENT# if isinstance ( obj , dict ) : #NEWLINE# #INDENT# for k in obj . keys ( ) : #NEWLINE# #INDENT# obj [ k ] = obj2dict ( obj [ k ] , classkey ) #NEWLINE# #UNINDENT# return obj #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if issequence ( obj ) : #NEWLINE# #INDENT# return [ obj2dict ( v , classkey ) for v in obj ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( obj , '__dict__' ) : #NEWLINE# #INDENT# data = dictset ( [ ( key , obj2dict ( value , classkey ) ) for ( key , value ) in obj . __dict__ . items ( ) if ( ( not six . callable ( value ) ) and ( not key . startswith ( '_' ) ) ) ] ) #NEWLINE# if ( ( classkey is not None ) and hasattr ( obj , '__class__' ) ) : #NEWLINE# #INDENT# data [ classkey ] = obj . __class__ . __name__ #NEWLINE# #UNINDENT# return data #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return obj