code: def _create_relationships(rel_data, image_id, classes_map, attrs_map):
      all_label_ids = rel_data["all_ids"]
      relevant_ids = rel_data["relevant_ids"]
      df = rel_data["df"]
  
      if image_id not in all_label_ids:
          return None
  
      if image_id not in relevant_ids:
          return fol.Detections()
  
      def _make_label(row):
          # ImageID,LabelName1,LabelName2,XMin1,XMax1,YMin1,YMax1,XMin2,
          #   XMax2,YMin2,YMax2,RelationshipLabel
  
          oi_label1 = row["LabelName1"]
          xmin1 = float(row["XMin1"])
          xmax1 = float(row["XMax1"])
          ymin1 = float(row["YMin1"])
          ymax1 = float(row["YMax1"])
  
          oi_label2 = row["LabelName2"]
          xmin2 = float(row["XMin2"])
          xmax2 = float(row["XMax2"])
          ymin2 = float(row["YMin2"])
          ymax2 = float(row["YMax2"])
  
          if oi_label1 in classes_map:
              label1 = classes_map[oi_label1]
          else:
              label1 = attrs_map[oi_label1]
  
          if oi_label2 in classes_map:
              label2 = classes_map[oi_label2]
          else:
              label2 = attrs_map[oi_label2]
  
          label_rel = row["RelationshipLabel"]
  
          xmin_int = min(xmin1, xmin2)
          ymin_int = min(ymin1, ymin2)
          xmax_int = max(xmax1, xmax2)
          ymax_int = max(ymax1, ymax2)
  
          bounding_box = [
              xmin_int,
              ymin_int,
              xmax_int - xmin_int,
              ymax_int - ymin_int,
          ]
  
          return fol.Detection(
              bounding_box=bounding_box,
              label=label_rel,
              Label1=label1,
              Label2=label2,
          )
  
      matching_df = _get_dataframe_rows(df, image_id)
      rels = [_make_label(row[1]) for row in matching_df.iterrows()]
      return fol.Detections(detections=rels)
  
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 26 for calling a global function with example usage: _create_relationships(rel_data, image_id, classes_map, attrs_map) and returns: fol, None, fol, fol