code: def _get_covered_entities(
      df: pandas.DataFrame, chosen: Collection[int]
  ) -> Set[int]:
      return set(
          numpy.unique(
              df.loc[df["index"].isin(chosen), [LABEL_HEAD, LABEL_TAIL]]
          )
      )
  
imports: import logging
  import typing
  from abc import abstractmethod
  from typing import Collection, Optional, Sequence, Set, Tuple, Type, Union
  import numpy
  import pandas
  import torch
  from class_resolver.api import ClassResolver, HintOrType
  from ..constants import COLUMN_LABELS
  from ..typing import LABEL_HEAD, LABEL_RELATION, LABEL_TAIL, MappedTriples, Target, TorchRandomHint
  from ..utils import ensure_torch_random_state
label_desc: Use image node_id 3 for calling a global function with example usage: _get_covered_entities(df, chosen) and returns: set