import math


def angle_difference(a1, a2):
    """
    Returns the angle difference between two orientations.

    Parameters
    ----------
    a1 : float
        An angle in radians
    a2 : float
        Another angle in radians

    Returns
    -------
    angle : float
        The angle difference in radians
    """
    return math.pi - abs(math.pi - abs(a1 - a2) % (math.pi*2))