def score_angle_difference(angle1: float, angle2: float) ->float:
    """Helper for `score_bearing` which scores the angle difference.

    Args:
        angle1, angle2: angles, in degrees.
    Returns:
        The similarity of angle1 and angle2, from 0.0 (180° difference) to 1.0 (0° difference)
    """
    difference = (abs(angle1 - angle2) + 180) % 360 - 180
    return 1 - abs(difference) / 180
