def itemindex(l):
    """itemindex(l) -> dict of item : index of item

    Make an index of the items in the list.  The dictionary contains
    the items in the list as the keys, and the index of the first
    occurrence of the item as the value.
    Adapted from BioPython.
    """
    dict = {}
    for i in range(len(l)):
        if l[i] not in dict:
            dict[l[i]] = i
    return dict
