code: def write_Track(file, track, bpm=120, repeat=0, verbose=False):
      
      m = MidiFile()
      t = MidiTrack(bpm)
      m.tracks = [t]
      while repeat >= 0:
          t.play_Track(track)
          repeat -= 1
      return m.write_file(file, verbose)
docs: Write a mingus.Track to a MIDI file.
  
      Write the name to the file and set the instrument if the instrument has
      the attribute instrument_nr, which represents the MIDI instrument
      number. The class MidiInstrument in mingus.containers.Instrument has
      this attribute by default.