def wrap(x, low=0, high=360):
    """
    Extended modulo function. Converts a number outside of a range between two numbers by
    continually adding or substracting the span between these numbers.

    Parameters
    ----------
    x : int or float
        number to be wrapped
    low : int or float, optional
        lowest value of the wrap (default: 0)
    high : int or float, optional
        lowest value of the wrap (default: 360)

    Returns
    -------
    x : float
        wrapped number
    """
    angle_range = high - low
    x = ((x - low) % angle_range) + low
    return x