def check_highlights_field(hit, highlight=ResultsFields.highlights):
    """
    check the validity of the highlights in the hit
    """

    if highlight in hit:
        if len(hit[highlight]) == 0:
            return False
        elif isinstance(hit[highlight], dict):
            if hit[highlight].values() == 0:
                return False
            else:
                return True
        else:
            raise RuntimeError("invalid hits and highlights")
    else:
        return False

    check the validity of the highlights in the hit
    
examples/GPT-examples/utilities.py