import csv


def write_to_csv(dataset):
    """[writing dataset in a csv file]

    Arguments:
        dataset {[defaultdict]} -- [key value pair of email and name]
    """
    with open("dataset.csv", mode='w', newline='', encoding="utf-8") as w_file:
        # definging the heading of the file
        heading = ['Name', 'Email']
        # creating a csv writer object
        writer = csv.DictWriter(w_file, fieldnames=heading)
        # writing the first row
        writer.writeheader()
        for key, value in dataset.items():
            writer.writerow({'Name': ', '.join(value), 'Email': key})

    return None