def _check_legend_labels(self, axes, labels=None, visible=True):
if visible and (labels is None):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>axes = self._flatten_visible(axes)<EOL>for ax in axes:<EOL><INDENT>if visible:<EOL><INDENT>assert ax.get_legend() is not None<EOL>self._check_text_labels(ax.get_legend().get_texts(), labels)<EOL><DEDENT>else:<EOL><INDENT>assert ax.get_legend() is None<EOL><DEDENT><DEDENT>
Check each axes has expected legend labels

Parameters
----------
axes : matplotlib Axes object, or its list-like
labels : list-like
    expected legend labels
visible : bool
    expected legend visibility. labels are checked only when visible is
    True