def get_primary_label(topic, primary_labels):
    """Function that returns the primary (preferred) label for a topic. If this topic belongs to
    a cluster.

    Args:
        topic (string): Topic to analyse.
        primary_labels (dictionary): It contains the primary labels of all the topics belonging to clusters.

    Returns:
        topic (string): primary label of the analysed topic.
    """

    try:
        topic = primary_labels[topic]
    except KeyError:
        pass

    return topic