#NEWLINE# def writeFile( familydir , metadata ) : #NEWLINE# #INDENT# filename = METADATA_PB #NEWLINE# if hasMetadata ( familydir ) : #NEWLINE# #INDENT# filename = METADATA_PB_NEW #NEWLINE# #UNINDENT# msg_str = text_format . MessageToString ( metadata , as_utf8 = True ) #NEWLINE# open ( os . path . join ( familydir , filename ) , 'w' ) . write ( msg_str )