human
I wrote the below code

    if params['butterfly']:
        _draw_vert_line(np.array(([event.xdata] * 2)), params)
        return bads
    def f(x, y):
        return y(np.mean(x), (x.std() * 2))
    lines = event.inaxes.lines
    for line in lines:
        ydata = line.get_ydata()
        if ((not isinstance(ydata, list)) and (not np.isnan(ydata).any())):
            (ymin, ymax) = (f(ydata, np.subtract), f(ydata, np.add))
            if (ymin <= event.ydata <= ymax):
                this_chan = vars(line)['ch_name']
                if (this_chan in params['info']['ch_names']):
                    if ('fig_selection' in params):
                        ch_idx = _find_channel_idx(this_chan, params)
                        _handle_topomap_bads(this_chan, params)
                    else:
                        ch_idx = [(params['ch_start'] + lines.index(line))]
                    if (this_chan not in bads):
                        bads.append(this_chan)
                        color = params['bad_color']
                        line.set_zorder((-1))
                    else:
                        while (this_chan in bads):
                            bads.remove(this_chan)
                        color = vars(line)['def_color']
                        line.set_zorder(0)
                    line.set_color(color)
                    for idx in ch_idx:
                        params['ax_vscroll'].patches[idx].set_color(color)
                    break
    else:
        _draw_vert_line(np.array(([event.xdata] * 2)), params)
    return bads

What's a good function header?
assistant
#Here's a good function header.

def _select_bads(event, params, bads):