def tally_advising_assignments(database,base_set,count_defended=False):
    """ Tally advising roles by faculty member.

    Arguments:
        database (list of dict) : student database
        base_set (list) : base set of faculty to include, even if unassigned
        count_defended (bool,optional): whether or not to count defended students in current load

    Returns:
        (tuple of dict) : (advisor_tally,coadvisor_tally,committee_tally)
            mapping committee member name to assignment count
    """

    # initialize tallies
    advisor_tally = dict()
    coadvisor_tally = dict()
    committee_tally = dict()
    for member in base_set:
        advisor_tally[member]=0
        coadvisor_tally[member]=0
        committee_tally[member]=0

    for entry in database:

        if ((not count_defended) and (entry["candidacy_status"] == "D")):
            continue

        advisor = entry["advisor"]
        advisor_tally[advisor] = advisor_tally.get(advisor,0)+1

        coadvisor = entry["coadvisor"]
        if (coadvisor != ""):
            coadvisor_tally[coadvisor] = coadvisor_tally.get(coadvisor,0)+1

        for member in entry["committee"]:
            committee_tally[member] = committee_tally.get(member,0)+1

    return (advisor_tally,coadvisor_tally,committee_tally)