def wrap_360(valin):
    """
    Wraps a value (float) to a 0--360 degree range.  
    
    Parameters
    ----------
    valin: float
        Input value in degrees
    
    Returns
    -------
    valout : float
    
    Example
    -------
    # e.g., 370 degrees is equivalent to 10 degrees.  \n
    obs.wrap_360(370)  #--> 10.
    
    Note
    ----
    Essentially equivalent to calculating as  (valin % 360) .
    """
    if (valin<0.0): n_revs=int(valin/360.)-1; valout=valin-n_revs*360.
    elif (valin>=360.0): n_revs=int(valin/360.); valout=valin-n_revs*360.
    else: valout=valin
    return valout