def METHOD_NAME(comp_dict, top=5):
    """
    Sort the errors in comp_dict from the most frequent to least frequent in a
    list.
    Return <top> most frequently occurring errors.
    @type comp_dict: Dict[str, number]
    @type top: int
    @rtype: List[Tuple[str, number]]
    """
    # get key-value pair in a list
    most_frequently = list(comp_dict.items())
    # sort the list according to the value, from larger number to lower number
    most_frequently.sort(key=lambda p: p[1], reverse=True)
    # So the name of the error first and then the number of its occurrence.
    # return the top whatever number
    return most_frequently[:top]