<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def determine(note1, note2, shorthand=False):
 """Name the interval between note1 and note2. Examples: 'major third' 'minor third' 'augmented third' 'diminished third' This works for all intervals. Note that there are corner cases for major fifths and fourths: 'perfect fifth' 'perfect fourth' """

    # Corner case for unisons ('A' and 'Ab', for instance)
    if note1[0] == note2[0]:
        def get_val(note):
            """Private function: count the value of accidentals."""
            r = 0
            for x in note[1:]:
                if x == 'b':
                    r -= 1
                elif x == '#':
                    r += 1
            return r

        x = get_val(note1)
        y = get_val(note2)
        if x == y:
            if not shorthand:
                return 'major unison'
            return '1'
        elif x < y:
            if not shorthand:
                return 'augmented unison'
            return '#1'
        elif x - y == 1:
            if not shorthand:
                return 'minor unison'
            return 'b1'
        else:
            if not shorthand:
                return 'diminished unison'
            return 'bb1'

    # Other intervals
    n1 = notes.fifths.index(note1[0])
    n2 = notes.fifths.index(note2[0])
    number_of_fifth_steps = n2 - n1
    if n2 < n1:
        number_of_fifth_steps = len(notes.fifths) - n1 + n2

    # [name, shorthand_name, half notes for major version of this interval]
    fifth_steps = [
        ['unison', '1', 0],
        ['fifth', '5', 7],
        ['second', '2', 2],
        ['sixth', '6', 9],
        ['third', '3', 4],
        ['seventh', '7', 11],
        ['fourth', '4', 5],
        ]

    # Count half steps between note1 and note2
    half_notes = measure(note1, note2)

    # Get the proper list from the number of fifth steps
    current = fifth_steps[number_of_fifth_steps]

    # maj = number of major steps for this interval
    maj = current[2]

    # if maj is equal to the half steps between note1 and note2 the interval is
    # major or perfect
    if maj == half_notes:
        # Corner cases for perfect fifths and fourths
        if current[0] == 'fifth':
            if not shorthand:
                return 'perfect fifth'
        elif current[0] == 'fourth':
            if not shorthand:
                return 'perfect fourth'
        if not shorthand:
            return 'major ' + current[0]
        return current[1]
    elif maj + 1 <= half_notes:
        # if maj + 1 is equal to half_notes, the interval is augmented.
        if not shorthand:
            return 'augmented ' + current[0]
        return '#' * (half_notes - maj) + current[1]
    elif maj - 1 == half_notes:
        # etc.
        if not shorthand:
            return 'minor ' + current[0]
        return 'b' + current[1]
    elif maj - 2 >= half_notes:
        if not shorthand:
            return 'diminished ' + current[0]
        return 'b' * (maj - half_notes) + current[1]