#NEWLINE# def write( self , filename ) : #NEWLINE# #INDENT# if isinstance ( filename , str ) : #NEWLINE# #INDENT# with open ( filename , 'wb' ) as midifile : #NEWLINE# #INDENT# self . midi_data . writeFile ( midifile ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . midi_data . writeFile ( filename )