def compute_tally(vec):
    """
    Here vec is an iterable of elements.
    Return dict giving tally of elements.
    """

    tally = dict()
    for x in vec:
        tally[x] = tally.get(x, 0) + 1
    return tally