import math


def airmass(Z, units='degrees'):
    """Calculate the airmass for a source according to Airmass=sec(Z) where
       Z is the zenith distnce
 
       Z--zenith distance
       units--units of Z
    """
    if units=='degrees': Z=math.radians(Z)
    return 1.0/math.cos(Z)