import statistics


def smooth(data_in, window_size):
    """Smooths the data, which should be a list, by averaging with the given window size."""
    data_in_len = len(data_in)
    data_out_len = data_in_len - window_size + 1
    if data_out_len <= 0:
        return data_in

    data_out = []
    for i in range(0, data_out_len):
        val = statistics.mean(data_in[i:i + window_size])
        data_out.append(val)
    return data_out