code: def _get_all_label_data(
      dataset_dir,
      image_ids,
      label_types=None,
      classes=None,
      oi_classes=None,
      attrs=None,
      oi_attrs=None,
      seg_classes=None,
      pnt_classes=None,
      download_only=False,
      ids_only=False,
      track_all_ids=True,
      only_matching=False,
      split=None,
      download=False,
      version=None,
  ):
      cls_data = {}
      det_data = {}
      pnt_data = {}
      rel_data = {}
      seg_data = {}
  
      all_classes_ids = set(image_ids)
      any_classes_ids = set()
  
      all_attrs_ids = set(image_ids)
      any_attrs_ids = set()
  
      _label_types = _parse_label_types(version, label_types)
  
      did_download = False
  
      if "classifications" in _label_types:
          if download:
              url = _ANNOTATION_DOWNLOAD_URLS[split]["classifications"]
          else:
              url = None
  
          (
              cls_all_ids,
              cls_any_ids,
              cls_data,
              _did_download,
          ) = _get_label_data(
              dataset_dir,
              image_ids,
              "classifications",
              classes=classes,
              oi_classes=oi_classes,
              download_only=download_only,
              ids_only=ids_only,
              track_all_ids=track_all_ids,
              only_matching=only_matching,
              url=url,
              download=download,
          )
          did_download |= _did_download
  
          # Classifications only capture the label schema, so don't use them for
          # ID list purposes unless they were the only label type requested
          if len(_label_types) == 1:
              all_classes_ids &= cls_all_ids
              any_classes_ids |= cls_any_ids
  
      if "detections" in _label_types:
          if download:
              url = _ANNOTATION_DOWNLOAD_URLS[split]["detections"]
          else:
              url = None
  
          (
              det_all_ids,
              det_any_ids,
              det_data,
              _did_download,
          ) = _get_label_data(
              dataset_dir,
              image_ids,
              "detections",
              classes=classes,
              oi_classes=oi_classes,
              url=url,
              download=download,
              download_only=download_only,
              ids_only=ids_only,
              track_all_ids=track_all_ids,
              only_matching=only_matching,
          )
          did_download |= _did_download
  
          all_classes_ids &= det_all_ids
          any_classes_ids |= det_any_ids
  
      if "points" in _label_types:
          if download:
              url = _ANNOTATION_DOWNLOAD_URLS[split]["points"]
          else:
              url = None
  
          (
              pnt_all_ids,
              pnt_any_ids,
              pnt_data,
              _did_download,
          ) = _get_label_data(
              dataset_dir,
              image_ids,
              "points",
              classes=classes,
              oi_classes=oi_classes,
              url=url,
              download=download,
              download_only=download_only,
              ids_only=ids_only,
              track_all_ids=track_all_ids,
              only_matching=only_matching,
          )
          did_download |= _did_download
  
          all_classes_ids &= pnt_all_ids
          any_classes_ids |= pnt_any_ids
  
      if "relationships" in _label_types:
          if download:
              url = _ANNOTATION_DOWNLOAD_URLS[split]["relationships"]
          else:
              url = None
  
          (
              rel_all_ids,
              rel_any_ids,
              rel_data,
              _did_download,
          ) = _get_label_data(
              dataset_dir,
              image_ids,
              "relationships",
              classes=attrs,
              oi_classes=oi_attrs,
              download_only=download_only,
              ids_only=ids_only,
              track_all_ids=track_all_ids,
              only_matching=only_matching,
              url=url,
              download=download,
          )
          did_download |= _did_download
  
          all_attrs_ids &= rel_all_ids
          any_attrs_ids |= rel_any_ids
  
      if "segmentations" in _label_types:
          if classes is not None and label_types is not None:
              non_seg_classes = sorted(set(classes) - set(seg_classes))
              if non_seg_classes:
                  logger.warning(
                      "No segmentations exist for classes %s\nYou can view the "
                      "available segmentation classes via "
                      "`get_segmentation_classes()`",
                      non_seg_classes,
                  )
  
          if download:
              url = _ANNOTATION_DOWNLOAD_URLS[split]["segmentations"][
                  "mask_csv"
              ]
          else:
              url = None
  
          (
              seg_all_ids,
              seg_any_ids,
              seg_data,
              _did_download,
          ) = _get_label_data(
              dataset_dir,
              image_ids,
              "segmentations",
              classes=classes,
              oi_classes=oi_classes,
              download_only=download_only,
              ids_only=ids_only,
              track_all_ids=track_all_ids,
              only_matching=only_matching,
              url=url,
              download=download,
          )
          did_download |= _did_download
  
          all_classes_ids &= seg_all_ids
          any_classes_ids |= seg_any_ids
  
      if classes is not None:
          all_label_ids = all_classes_ids
          any_label_ids = any_classes_ids
  
          if attrs is not None:
              all_label_ids &= all_attrs_ids
              any_label_ids &= any_attrs_ids
      elif attrs is not None:
          all_label_ids = all_attrs_ids
          any_label_ids = any_attrs_ids
      else:
          all_label_ids = all_classes_ids & all_attrs_ids
          any_label_ids = any_classes_ids | any_attrs_ids
  
      return (
          cls_data,
          det_data,
          pnt_data,
          rel_data,
          seg_data,
          all_label_ids,
          any_label_ids,
          did_download,
      )
  
imports: from collections import defaultdict
  import csv
  from glob import glob
  import logging
  import os
  import random
  import warnings
  import pandas
  import eta.core.image
  import eta.core.serial
  import eta.core.utils
  import eta.core.web
  import fiftyone
  import fiftyone.core.fields
  import fiftyone.core.labels
  import fiftyone.utils.aws
  import fiftyone.utils.data
  import fiftyone.utils.image
label_desc: Use image node_id 20 for calling a global function with example usage: _get_all_label_data(dataset_dir, image_ids, label_types, classes, oi_classes, attrs, oi_attrs, seg_classes, pnt_classes, download_only, ids_only, track_all_ids, only_matching, split, download, version) and returns: cls_data,  det_data,  pnt_data,  rel_data,  seg_data,  all_label_ids,  any_label_ids,  did_download