from typing import Optional
from typing import Tuple


def _get_labels(
    x_label: Optional[str],
    y_label: Optional[str],
    title: Optional[str],
    xlabel_str: str,
) -> Tuple[str, str, str]:
    """
    Get the axes labels.

    Set the arguments *xlabel*, *ylabel*, *title* passed to the plot
    functions :func:`plot_cluster_lines
    <skfda.exploratory.visualization.clustering_plots.plot_cluster_lines>` and
    :func:`plot_cluster_bars
    <skfda.exploratory.visualization.clustering_plots.plot_cluster_bars>`,
    in case they are not set yet.

    Args:
        x_label: Label for the x-axes.
        y_label: Label for the y-axes.
        title: Title for the figure where the clustering results are
            ploted.
        xlabel_str: In case xlabel is None, string to use for the labels
            in the x-axes.

    Returns:
        xlabel: Labels for the x-axes.
        ylabel: Labels for the y-axes.
        title: Title for the figure where the clustering results are
            plotted.
    """
    if x_label is None:
        x_label = xlabel_str

    if y_label is None:
        y_label = "Degree of membership"

    if title is None:
        title = "Degrees of membership of the samples to each cluster"

    return x_label, y_label, title