import csv


def proc_attendees(att_file, config):
    """Opens the attendee list file, reads the contents and collects the
    desired information (currently first name, last name and email addresses)
    of the actual attendees into a dictionary keyed by the lowercase email
    address.  This collection is returned.
    This collection allows for quick look-up (for checking attendance)
    and eliminates duplicate email addresses.
    
    Args:
        att_file - file object for the file containing the list of attendees
                    We assume that this file object is valid, so no checking
        config - ConfigParser object containing the configuration data

    Returns:
        dictionary containing the de-duplicated collection of all attendees.
        Keys are the email attendee email addresses forced to lower case.
    """
    
    attendees = {}
    email_field = config['ATTENDEES']['EMAIL_FIELD']
    with att_file:
        reader = csv.DictReader(att_file)
        # use splitlines() to remove the line end characters
        #attendees = att.read().lower().splitlines()
        for row in reader:
            attendees[row[email_field].lower()] = row

    return attendees