'Return a list of all the key signatures used in this score.
Support different key signatures in different parts (score in
written pitch).
Ignores duplicate key signatures to prevent Magenta duplicate key
signature error. This happens when multiple parts have the same
key signature at the same time.
Example: If the score is in written pitch and the
flute is written in the key of Bb major, the trombone will also be
written in the key of Bb major. However, the clarinet and trumpet
will be written in the key of C major because they are Bb transposing
instruments.
If no key signatures are found, create a default key signature of
C major.
Returns:
A list of all KeySignature objects used in this score.'

def get_key_signatures(self):

    key_signatures = []
    for part in self.parts:
        for measure in part.measures:
            if (measure.key_signature is not None):
                if (measure.key_signature not in key_signatures):
                    key_signatures.append(measure.key_signature)
    if (not key_signatures):
        key_signature = KeySignature(self._state)
        key_signature.time_position = 0
        key_signatures.append(key_signature)
    return key_signatures
