def mode(lst):
    "Returns the most common value"
    # Count each item
    counts = defaultdict(int)
    for x in lst:
        counts[x] += 1

    # Determine the maximum count
    max = 0
    item = None
    for val, count in counts.items():
        if count > max:
            max = count
            item = val

    # Return the most common
    return item
dataset/ETHPy150Open armon/pypred/pypred/util.py/mode/original