code: def scan_directory(source_directory):
      """
      Scan a directory for images, returning any images found with the
      extensions ``.jpg``, ``.JPG``, ``.jpeg``, ``.JPEG``, ``.gif``, ``.GIF``,
      ``.img``, ``.IMG``, ``.png``, ``.PNG``, ``.tif``, ``.TIF``, ``.tiff``,
      or ``.TIFF``.
  
      :param source_directory: The directory to scan for images.
      :type source_directory: String
      :return: A list of images found in the :attr:`source_directory`
      """
      # TODO: GIFs are highly problematic. It may make sense to drop GIF support.
      file_types = [
          "*.jpg",
          "*.bmp",
          "*.jpeg",
          "*.gif",
          "*.img",
          "*.png",
          "*.tiff",
          "*.tif",
      ]
  
      list_of_files = []
  
      if os.name == "nt":
          for file_type in file_types:
              list_of_files.extend(
                  glob.glob(
                      os.path.join(
                          os.path.abspath(source_directory), file_type
                      )
                  )
              )
      else:
          file_types.extend([str.upper(str(x)) for x in file_types])
          for file_type in file_types:
              list_of_files.extend(
                  glob.glob(
                      os.path.join(
                          os.path.abspath(source_directory), file_type
                      )
                  )
              )
  
      return list_of_files
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from builtins import *
  import os
  import glob
  import numbers
  import random
  import warnings
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: scan_directory(source_directory) and returns: list_of_files