def is_label_or_synonym(labels, provided_label):
    """Determine if a user-provided ontology label is a valid label or synonymn
    :param labels: cached ontology label/synonyms from retriever.retrieve_ontology_term_label_and_synonyms
    :param provided_label: user-provided label from metadata file
    :return: True/False on match for label or synonym
    """
    label = labels.get('label')
    synonyms = labels.get('synonyms')
    if label.casefold() == provided_label.casefold():
        return True
    elif synonyms:
        if next((t for t in synonyms if t.casefold() == provided_label.casefold()), ''):
            return True
        else:
            return False
    else:
        return False