def note_freq(note: str):
    """ Given a note string, return the frequency
    For example:
    D2 -> 73.41619 Hz

    @param note:
    @return:
    """
    # general purpose function to convert a note in standard notation
    # to corresponding frequency
    if len(note) < 2 or len(note) > 3 or \
            note[0] < 'A' or note[0] > 'G':
        return 0
    if len(note) == 3:
        if note[1] == 'b':
            acc = -1
        elif note[1] == '#':
            acc = 1
        else:
            return 0
        octave = int(note[2])
    else:
        acc = 0
        octave = int(note[1])
    SEMITONES = {'A': 0, 'B': 2, 'C': -9, 'D': -7, 'E': -5, 'F': -4, 'G': -2}
    n = 12 * (octave - 4) + SEMITONES[note[0]] + acc
    f = 440 * (2 ** (float(n) / 12.0))
    return f