code: def _write_row(self, epoch_id: int, epoch_data: EpochData) -> None:
          
  
          # list of values to be written
          values = [epoch_id]
  
          for stream_name in self._streams:
              for variable_name in self._variables:
                  column_name = stream_name+'_'+variable_name
                  try:
                      value = epoch_data[stream_name][variable_name]
                  except KeyError as ex:
                      err_message = '`{}` not found in epoch data.'.format(column_name)
                      if self._on_missing_variable == 'error':
                          raise KeyError(err_message) from ex
                      elif self._on_missing_variable == 'warn':
                          logging.warning(err_message)
                      values.append(self._default_value)
                      continue
  
                  if isinstance(value, dict) and 'mean' in value:
                      value = value['mean']
                  elif isinstance(value, dict) and 'nanmean' in value:
                      value = value['nanmean']
  
                  if np.isscalar(value):
                      values.append(value)
                  else:
                      err_message = 'Variable `{}` value is not scalar.'.format(variable_name)
                      if self._on_unknown_type == 'error':
                          raise TypeError(err_message)
                      elif self._on_unknown_type == 'warn':
                          logging.warning(err_message)
                      values.append(self._default_value)
  
          # write the row
          with open(self._file_path, 'a') as file:
              row = self._delimiter.join([str(value) for value in values])
              file.write(row + '\n')
docs: Write a single epoch result row to the CSV file.
  
          :param epoch_id: epoch number (will be written at the first column)
          :param epoch_data: epoch data
          :raise KeyError: if the variable is missing and ``self._on_missing_variable`` is set to ``error``
          :raise TypeError: if the variable has wrong type and  ``self._on_unknown_type`` is set to ``error``