def _set_tick_labels_visibility(ax, visible=True):
    """Set the visibility of the tick labels of the requested axis."""
    for i, thisAxis in enumerate((ax.get_xaxis(), ax.get_yaxis())):
        for thisItem in thisAxis.get_ticklabels():
            if isinstance(visible, list):
                thisItem.set_visible(visible[i])
            else:
                thisItem.set_visible(visible)
Set the visibility of the tick labels of the requested axis.