code: def header(self):
          
          tracks = a2b_hex('%04x' % len([t for t in self.tracks if
              t.track_data != '']))
          return 'MThd\x00\x00\x00\x06\x00\x01' + tracks + self.time_division
docs: Return a header for type 1 MIDI file.