<s> import yaml <EOL> managed_objects = yaml . safe_load ( open ( "<STR_LIT>" ) ) <EOL> header_text = "<STR_LIT>" <EOL> footer_text = "<STR_LIT>" <EOL> body_text = "<STR_LIT>" <EOL> for i , mo in enumerate ( managed_objects ) : <EOL> if mo [ "<STR_LIT>" ] is None : <EOL> mo [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> body_text += "<STR_LIT>" % ( mo [ "<STR_LIT:name>" ] , mo [ "<STR_LIT>" ] ) <EOL> props = [ ] <EOL> for prop in mo [ "<STR_LIT>" ] : <EOL> props . append ( "<STR_LIT:%s>" % prop [ "<STR_LIT:name>" ] ) <EOL> body_text += "<STR_LIT>" % props <EOL> body_text += "<STR_LIT>" <EOL> body_text += "<STR_LIT>" % ( mo [ "<STR_LIT>" ] ) <EOL> body_text += ( "<STR_LIT>" % mo [ "<STR_LIT>" ] ) <EOL> for prop in mo [ "<STR_LIT>" ] : <EOL> body_text += "<STR_LIT>" <EOL> body_text += "<STR_LIT>" % prop [ "<STR_LIT:name>" ] <EOL> if prop [ "<STR_LIT>" ] is True : <EOL> body_text += ( "<STR_LIT>" % <EOL> ( prop [ "<STR_LIT:name>" ] , prop [ "<STR_LIT>" ] ) ) <EOL> else : <EOL> body_text += ( "<STR_LIT>" % <EOL> ( prop [ "<STR_LIT:name>" ] , prop [ "<STR_LIT>" ] ) ) <EOL> body_text += "<STR_LIT>" <EOL> footer_text += "<STR_LIT>" % mo [ "<STR_LIT:name>" ] <EOL> if i < ( len ( managed_objects ) - <NUM_LIT:1> ) : <EOL> footer_text += "<STR_LIT>" <EOL> else : <EOL> footer_text += "<STR_LIT:\n>" <EOL> footer_text += "<STR_LIT>" <EOL> footer_text += "<STR_LIT>" <EOL> footer_text += "<STR_LIT>" <EOL> f = open ( "<STR_LIT>" , "<STR_LIT:w>" ) <EOL> f . write ( header_text ) <EOL> f . write ( body_text ) <EOL> f . write ( footer_text ) <EOL> f . close ( ) </s>
