def dup_index(s: list) -> dict:
    """Gets a list that might have duplicates and creates a dict with the list
    items as keys and their index as values. Only return items that have duplicates.
    """
    d = {}

    for element in s:

        # This could be easily done with a Numpy array    
        indices = [index for index, e in enumerate(s) if e == element]
        d[element] = indices
    
    dups = {key: value for key, value in d.items() if len(value) > 1}
    
    return dups