def normalize_azimuth(azimuth, zero_center=False):
    """Normalize an azimuth in degrees so it falls between 0 and 360.
    
    If ``zero_center=True``, azimuth will be normalized
    between -180 and 180.
    """
    if (azimuth > 360 or azimuth < 0):
        azimuth %= 360
    if zero_center:
        if azimuth > 180:
            azimuth -= 360
    return azimuth