def index_roster(roster_table):
    """Convert roster table to dictionaries for by-student lookup.
    
    The key lookup dictionary provides lookup either by the last name
    or by the key itself.

    The roster dictionary provides only lookup by the key itself.

    One may thus ask for, e.g., 

        student = ta_info_by_ta[key_dict["Fasano"]]
        print(student["hours"])

        student = ta_info_by_ta[key_dict["Fasano:Patrick"]]
        print(student["hours"])

    Arguments:
        roster_table (list of dict) : TA records in input order
    
    Returns:
        (tuple) : (ta_keys,key_dict,ta_info_by_ta)

        ta_keys (list of str) : list of ta keys in input order
        key_dict (dict) : mapping from all accepted ta identifier values (str) to canonical key "last:first" (str)
        ta_info_by_ta (dict) : mapping from canonical key "last:first" (str) to ta record (dict)

    """

    # put each student record into dictionary
    ta_keys = []
    key_dict = {}
    ta_info_by_ta = {}
    for record in roster_table:
        ta_keys.append(record["key"])
        key_dict[record["last"]] = record["key"]
        key_dict[record["key"]] = record["key"]
        ta_info_by_ta[record["key"]] = record

    return (ta_keys,key_dict,ta_info_by_ta)