def firstEmail(m, d):
    """
    Engage stores emails and phone numbers in the 'contacts' section
    of a supporter record.  This function finds the first email.  If
    there's not an email record, then we'll return a None.
    
    Parameters:

        m   dict    supporter record
        d   string  default value if an email is not equipped
    
    Returns:

        string containing an email address, or
        None if no email is configured
    """

    if 'contacts' not in m:
        return d
    for c in m['contacts']:
        if c['type'] == 'EMAIL':
            return c['value']
    return d