code: def _check_labels(
      df: pandas.DataFrame,
      labels: bool,
      id_column_name: str,
      label_column_name: str,
      label_to_id: Mapping[str, int],
  ) -> Iterable[str]:
      if id_column_name in df.columns:
          yield id_column_name
  
          # check value range entity IDs
          assert df[id_column_name].isin(label_to_id.values()).all()
  
          if labels:
              yield label_column_name
  
              # check value range entity labels
              assert (
                  df[label_column_name].isin(label_to_id.keys()).all()
              )
  
imports: import itertools
  import unittest
  from typing import Iterable, Mapping
  import numpy
  import pandas
  from pykeen.datasets import Dataset, Nations
  from pykeen.datasets import analysis
  from pykeen.triples import analysis
  from pykeen.typing import LABEL_HEAD, LABEL_TAIL
label_desc: Use image node_id 3 for calling a global function with example usage: _check_labels(df, labels, id_column_name, label_column_name, label_to_id) without return types