class_docstr: Exports critique requests.
  
  - The requests will be exported to mturk/{template.name}/requests_{timestamp}.csv
  - The template Crowd HTML will be exported to mturk/{template.name}/layout_{timestamp}.html
docstr: Export a single critique request.
  
  - The request will be written as a row to mturk/{template.name}/requests_{timestamp}.csv
  - The template Crowd HTML will be written to mturk/{template.name}/layout_{timestamp}.html
    when this is called for the first time
docstr_tok: ["Export","a","single","critique","request",".","-","The","request","will","be","written","as","a","row","to","mturk\/","{","template.name","}","\/requests_","{","timestamp","}",".csv","-","The","template","Crowd","HTML","will","be","written","to","mturk\/","{","template.name","}","\/layout_","{","timestamp","}",".html","when","this","is","called","for","the","first","time"]
code: def export(self, fields: Dict[str, str]):
      """Export a single critique request.
  
      - The request will be written as a row to mturk/{template.name}/requests_{timestamp}.csv
      - The template Crowd HTML will be written to mturk/{template.name}/layout_{timestamp}.html
        when this is called for the first time"""
      with self._lock:
          if not self._field_names:
              self._initialize(list(fields.keys()))
          assert self._field_names
          # Unfortunately, we have to re-open and close the file every time.
          # TODO: Support exporting batches of requests.
          with open(self._requests_filename, "a") as f:
              dict_writer = csv.DictWriter(
                  f, fieldnames=self._field_names
              )
              dict_writer.writerow(fields)
  
imports: import csv
  from datetime import datetime
  import os
  from threading import Lock
  from typing import Dict, List, Sequence
  import textwrap
  import re
  from helm.common.critique_request import CritiqueQuestionTemplate, CritiqueRequest, CritiqueTaskTemplate, QuestionType
  from helm.common.general import ensure_directory_exists
  from helm.common.hierarchical_logger import hlog
label_desc: Use image node_id 4 for calling the _MechanicalTurkCritiqueRequestExporter obj's underlying member method code with example usage: obj.export(fields) without return types