def angular_difference(degrees1, degrees2):
    """
    Calculates the smaller angle between the provided bearings / headings
    """
    diff = abs(degrees1 - degrees2)
    if diff > 180:
        diff = abs(diff - 360)
    return diff