<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_wonambi(data, filename, subj_id='', dtype='float64'):
 """Write file in simple Wonambi format. Parameters data : instance of ChanTime data with only one trial filename : path to file file to export to (the extensions .won and .dat will be added) subj_id : str subject id dtype : str numpy dtype in which you want to save the data Notes ----- Wonambi format creates two files, one .won with the dataset info as json file and one .dat with the memmap recordings. It will happily overwrite any existing file with the same name. Memory-mapped matrices are column-major, Fortran-style, to be compatible with Matlab. """

    filename = Path(filename)

    json_file = filename.with_suffix('.won')
    memmap_file = filename.with_suffix('.dat')

    start_time = data.start_time + timedelta(seconds=data.axis['time'][0][0])

    start_time_str = start_time.strftime('%Y-%m-%d %H:%M:%S.%f')
    dataset = {'subj_id': subj_id,
               'start_time': start_time_str,
               's_freq': data.s_freq,
               'chan_name': list(data.axis['chan'][0]),
               'n_samples': int(data.number_of('time')[0]),
               'dtype': dtype,
               }

    with json_file.open('w') as f:
        dump(dataset, f, sort_keys=True, indent=4)

    memshape = (len(dataset['chan_name']),
                dataset['n_samples'])

    mem = memmap(str(memmap_file), dtype, mode='w+', shape=memshape, order='F')
    mem[:, :] = data.data[0]
    mem.flush()