<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_template(self, channeldir, filename, header):
 """ Create empty template .csv file called `filename` as siblings of the directory `channeldir` with header fields specified in `header`. """

        file_path = get_metadata_file_path(channeldir, filename)
        if not os.path.exists(file_path):
            with open(file_path, 'w') as csv_file:
                csvwriter = csv.DictWriter(csv_file, header)
                csvwriter.writeheader()