class_docstr: Yelp MD Gender Teacher.
code: def _check_data_downloaded(self, opt):
      # Checks whether the data is downloaded properly
      # Also checks whether data is built, and builds it if so
      RESET = "\033[0m"
      RED = "\033[1;91m"
      YELLOW = "\033[1;93m"
      GREEN = "\033[1;92m"
      BLUE = "\033[1;96m"
      CYAN = "\033[1;94m"
      MAGENTA = "\033[1;95m"
  
      # only use colors if we're outputting to a terminal
      USE_COLORS = _sys.stdout.isatty()
      if not USE_COLORS:
          RESET = RED = YELLOW = GREEN = BLUE = CYAN = MAGENTA = ""
  
      # generate the rainbow stars
      rainbow = [RED, YELLOW, GREEN, CYAN, BLUE, MAGENTA]
      size = 78 // len(rainbow)
      stars = "".join([color + "*" * size for color in rainbow])
      stars += RESET
  
      self.data_path = os.path.join(
          opt["datapath"], "md_gender", "yelp"
      )
      if not os.path.exists(self.data_path):
          PathManager.mkdirs(self.data_path)
      if not PathManager.exists(
          os.path.join(self.data_path, "valid.fader.with_cat.40000")
      ):
          raise RuntimeError(
              f"\n\n{stars}\nThis data must be downloaded following instructions in "
              "the README here:"
              "<https://github.com/facebookresearch/MultipleAttributeTextRewriting/blob/main/data/README.md>. "
              "\nIt cannot be automatically downloaded, as one must agree to "
              "the terms outlined on the website before gaining access to the data.\n\n"
              "Once downloaded, please put the data in the following "
              f"directory: \n{self.data_path}\n{stars}"
          )
      elif not PathManager.exists(
          os.path.join(self.data_path, "classtrain.txt")
      ):
          logging.info("[ Building data ... ]")
          # build train
          with open(
              os.path.join(self.data_path, "classtrain.txt"), "w"
          ) as f:
              for fle_num in [4000, 6000, 8000]:
                  train_fle = f"train.fader.with_cat.{fle_num}"
                  with open(
                      os.path.join(self.data_path, train_fle)
                  ) as g:
                      lines = g.readlines()
                      for line in lines:
                          tabs = line.split("\t")
                          text = tabs[0]
                          gend = tabs[1]
                          if gend == "0":
                              f.write(f"male\t{text}\n")
                          elif gend == "1":
                              f.write(f"female\t{text}\n")
  
          # build valid and test
          for pair in [("dev", "valid"), ("test", "test")]:
              with open(
                  os.path.join(
                      self.data_path, f"female_only.{pair[0]}.en"
                  ),
                  "w",
              ) as fem_val:
                  with open(
                      os.path.join(
                          self.data_path, f"male_only.{pair[0]}.en"
                      ),
                      "w",
                  ) as masc_val:
                      for fle_num in [4000, 6000, 8000]:
                          valid_fle = (
                              f"{pair[1]}.fader.with_cat.{fle_num}"
                          )
                          with open(
                              os.path.join(self.data_path, valid_fle),
                              "r",
                          ) as g:
                              lines = g.readlines()
                              for line in lines:
                                  tabs = line.split("\t")
                                  text = tabs[0]
                                  gend = tabs[1]
                                  if gend == "0":
                                      masc_val.write(f"{text}\n")
                                  elif gend == "1":
                                      fem_val.write(f"{text}\n")
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.utils.io import PathManager
  import parlai.tasks.md_gender.utils
  import parlai.utils.logging
  from copy import deepcopy
  import os
  import random
  import sys
label_desc: Use image node_id 3 for calling the YelpTeacher obj's underlying member method code with example usage: obj._check_data_downloaded(opt) without return types