def calculate_color(
    vertex_id: int, current_color: int, maxima: bool, messages: list, superstep: int
) -> dict:
    """UDF that calculates the color of the nodes. Based on Local Maxima First algorithm
    :param vertex_id: The id of the node/vertex
    :param current_color: The current color of the vertex
    :param maxima: Flag that indicates if the node is maxima
    :param messages: List that contains the neighbor ids that send message
    :param superstep: The superstep number
    :return: Dictionary that contains the new color and the status of maxima
    """
    # Return if you have already been colored!
    if current_color != -1:
        return {"id": id, "new_color": current_color, "new_maxima": True}
    # Local Maxima first interal procedure
    for message in messages:
        if vertex_id < message:
            maxima = False
            break
    return (
        {"id": id, "new_color": superstep, "new_maxima": maxima}
        if maxima
        else {"id": id, "new_color": current_color, "new_maxima": True}
    )