code: def canonic_data_files(
      data_files: Union[list, dict], root_dir: Optional[_Path] = None
  ) -> List[Tuple[str, List[str]]]:
      """For compatibility with ``setup.py``, ``data_files`` should be a list
      of pairs instead of a dict.
  
      This function also expands glob patterns.
      """
      if isinstance(data_files, list):
          return data_files
  
      return [
          (dest, glob_relative(patterns, root_dir))
          for dest, patterns in data_files.items()
      ]
  
imports: import ast
  import importlib
  import os
  import pathlib
  import sys
  from glob import iglob
  from configparser import ConfigParser
  from importlib.machinery import ModuleSpec
  from itertools import chain
  from typing import TYPE_CHECKING, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, TypeVar, Union, cast
  from pathlib import Path
  from types import ModuleType
  from distutils.errors import DistutilsOptionError
  from .._path import same_path
  from ..warnings import SetuptoolsWarning
label_desc: Use image node_id 16 for calling a global function with example usage: canonic_data_files(data_files, root_dir) and returns: unknown, data_files