code: def file_has_allowed_extension(
      filename: str, extensions: Union[str, Tuple[str, ...]]
  ) -> bool:
      """Checks if a file has an allowed extension.
  
      Args:
          filename: Path to a file.
          extensions: A string or a tuple of strings specifying the file extensions.
  
      Returns:
          True if the filename ends with one of given extensions, else False
      """
      return filename.lower().endswith(extensions)
  
file_path: ml-cvnets/data/datasets/utils/common.py
imports: import collections
  import os
  import random
  from typing import Any, List, Optional, Tuple, Union
label_desc: Use image node_id 2 for calling a global function with example usage: file_has_allowed_extension(filename, extensions) and returns: filename