def key_to_note(key, octaves=True):
    """Returns a string representing a note which is (key) keys from A0"""
    notes = ['a', 'a#', 'b', 'c', 'c#', 'd', 'd#', 'e', 'f', 'f#', 'g', 'g#']
    octave = (key + 8) // 12
    note = notes[(key - 1) % 12]

    if octaves:
        return note.upper() + str(octave)
    else:
        return note.upper()