def draw_fret_markers(draw, instrument, movable_shift, palette):
    """Add the fret markers onto the image"""
    for fret_pos in instrument.marker_positions:
        y_pos = instrument.top_gap + instrument.nut_width + (fret_pos -
            movable_shift
            ) * instrument.fret_spacing - instrument.fret_spacing / 2
        if y_pos <= instrument.top_gap:
            continue
        if fret_pos in instrument.double_markings:
            x_pos = (instrument.margin + instrument.first_string_gap +
                instrument.string_spacing)
            draw.ellipse((x_pos - instrument.marker_size, y_pos -
                instrument.marker_size, x_pos + instrument.marker_size, 
                y_pos + instrument.marker_size), palette.fret_marker_colour)
            x_pos = (instrument.margin + instrument.first_string_gap + 
                instrument.string_spacing * 4)
            draw.ellipse((x_pos - instrument.marker_size, y_pos -
                instrument.marker_size, x_pos + instrument.marker_size, 
                y_pos + instrument.marker_size), palette.fret_marker_colour)
        else:
            x_pos = (instrument.margin + instrument.first_string_gap + 
                instrument.number_of_strings / 2 * instrument.
                string_spacing - instrument.string_spacing / 2)
            draw.ellipse((x_pos - instrument.marker_size, y_pos -
                instrument.marker_size, x_pos + instrument.marker_size, 
                y_pos + instrument.marker_size), palette.fret_marker_colour)
    return draw
