'Parse the MusicXML <key> element into a MIDI compatible key.
If the mode is not minor (e.g. dorian), default to "major"
because MIDI only supports major and minor modes.'

def _parse(self):

    self.key = int(self.xml_key.find('fifths').text)
    mode = self.xml_key.find('mode')
    if (mode != 'minor'):
        mode = 'major'
    self.mode = mode
    self.time_position = self.state.time_position
