def duplicate_elements(vals, n):
    """
    takes list `vals` and duplicates each element `n` times
    (e.g., `n=1` will return `vals`)
    """
    return sum(map(list, zip(*[vals for _ in range(n)])), [])
