code: def _parse_source_dir(
      source_dir, fine_annos, coarse_annos, person_annos
  ):
      if source_dir is None:
          _raise_cityscapes_error(
              "You must provide a `source_dir` in order to load the Cityscapes "
              "dataset."
          )
  
      if not os.path.isdir(source_dir):
          _raise_cityscapes_error(
              "Source directory '%s' does not exist." % source_dir
          )
  
      files = etau.list_files(source_dir)
  
      if _IMAGES_ZIP not in files:
          _raise_cityscapes_error(
              "Images zip '%s' not found within '%s'."
              % (_IMAGES_ZIP, source_dir)
          )
  
      images_zip_path = os.path.join(source_dir, _IMAGES_ZIP)
  
      if fine_annos is None:
          fine_annos = _FINE_ANNOS_ZIP in files
  
      if fine_annos:
          if _FINE_ANNOS_ZIP not in files:
              _raise_cityscapes_error(
                  "Fine annotations zip '%s' not found within '%s'."
                  % (_FINE_ANNOS_ZIP, source_dir)
              )
  
          fine_annos_zip_path = os.path.join(
              source_dir, _FINE_ANNOS_ZIP
          )
      else:
          fine_annos_zip_path = None
  
      if coarse_annos is None:
          coarse_annos = _COARSE_ANNOS_ZIP in files
  
      if coarse_annos:
          if _COARSE_ANNOS_ZIP not in files:
              _raise_cityscapes_error(
                  "Coarse annotations zip '%s' not found within '%s'."
                  % (_COARSE_ANNOS_ZIP, source_dir)
              )
  
          coarse_annos_zip_path = os.path.join(
              source_dir, _COARSE_ANNOS_ZIP
          )
      else:
          coarse_annos_zip_path = None
  
      if person_annos is None:
          person_annos = _PERSON_ANNOS_ZIP in files
  
      if person_annos:
          if _PERSON_ANNOS_ZIP not in files:
              _raise_cityscapes_error(
                  "Person annotations zip '%s' not found within '%s'."
                  % (_PERSON_ANNOS_ZIP, source_dir)
              )
  
          person_annos_zip_path = os.path.join(
              source_dir, _PERSON_ANNOS_ZIP
          )
      else:
          person_annos_zip_path = None
  
      return (
          images_zip_path,
          fine_annos_zip_path,
          coarse_annos_zip_path,
          person_annos_zip_path,
      )
  
imports: import logging
  import os
  import eta.core.serial
  import eta.core.utils
  import fiftyone.core.dataset
  import fiftyone.core.fields
  import fiftyone.core.labels
  import fiftyone.core.media
  import fiftyone.core.sample
  import fiftyone.core.utils
  import fiftyone.utils.data
  import fiftyone.types
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_source_dir(source_dir, fine_annos, coarse_annos, person_annos) and returns: images_zip_path,  fine_annos_zip_path,  coarse_annos_zip_path,  person_annos_zip_path