def get_dups(l):
    """
    Iterate over given list keeping track of
    elements already seen by using 'seen_elements'
    and return repeated ones in 'dups' set.

    l: input list of generic elements
    return: duplicated elements as a set
    """

    dups = set()
    seen_elements = []

    for n in l:
        if n in seen_elements:
            dups.add(n)
        else:
            seen_elements.append(n)

    return dups