def _label_anchor_residues(ax, anchor_residues):
    """
    Label bars in barplot that are listed as anchor residues.

    Parameters
    ----------
    ax : matplotlib.pyplot.axis
        Plot axis for bar plot with 85 bars.
    anchor_residues : None or dict (str: list of int)
        Dictionary of anchor residues (values: list of residue KLIFS IDs) for one or more
        subpockets (keys: subpocket name). If not none, asterisks is placed over anchor residue
        bars.

    Returns
    -------
    matplotlib.pyplot.axis
        Plot axis.
    """
    if anchor_residues:
        anchor_residues_flat = [
            residue_id for residue_ids in anchor_residues.values() for residue_id in residue_ids
        ]
        for residue_id, patch in enumerate(ax.patches, 1):
            if residue_id in anchor_residues_flat:
                ax.annotate("*", (patch.get_x(), patch.get_height()), size=10)
    return ax