code: def write_metadata(self):
          
          import mutagen
          from mutagen import id3
  
          id3 = id3.ID3(self.filename)
          for tag in self.metadata.keys():
              value = self.metadata[tag]
              frame = mutagen.id3.Frames[tag](3, value)
              try:
                  id3.add(frame)
              except:
                  raise IOError('EncoderError: cannot tag "' + tag + '"')
          try:
              id3.save()
          except:
              raise IOError('EncoderError: cannot write tags')
docs: Write all ID3v2.4 tags to file from self.metadata