code: def library_paths():
      """Iterates for library paths to try loading.  The result paths are not
      guaranteed that they exist.
  
      :returns: a pair of libwand and libmagick paths.  they can be the same.
                path can be ``None`` as well
      :rtype: :class:`tuple`
  
      """
      libwand = None
      libmagick = None
      versions = (
          "",
          "-7",
          "-7.Q8",
          "-7.Q16",
          "-6",
          "-Q16",
          "-Q8",
          "-6.Q16",
      )
      options = "", "HDRI", "HDRI-2"
      system = platform.system()
      magick_home = os.environ.get("MAGICK_HOME")
      magick_suffix = os.environ.get("WAND_MAGICK_LIBRARY_SUFFIX")
  
      if system == "Windows":
          # ImageMagick installers normally install coder and filter DLLs in
          # subfolders, we need to add those folders to PATH, otherwise loading
          # the DLL later will fail.
          try:
              with winreg.OpenKey(
                  winreg.HKEY_LOCAL_MACHINE,
                  r"SOFTWARE\ImageMagick\Current",
              ) as reg_key:
                  libPath = winreg.QueryValueEx(reg_key, "LibPath")
                  coderPath = winreg.QueryValueEx(
                      reg_key, "CoderModulesPath"
                  )
                  filterPath = winreg.QueryValueEx(
                      reg_key, "FilterModulesPath"
                  )
                  magick_home = libPath[0]
                  os.environ["PATH"] += str(
                      (
                          ";"
                          + libPath[0]
                          + ";"
                          + coderPath[0]
                          + ";"
                          + filterPath[0]
                      )
                  )
          except OSError:
              # otherwise use MAGICK_HOME, and we assume the coder and
              # filter DLLs are in the same directory
              pass
  
      def magick_path(path):
          return os.path.join(magick_home, *path)
  
      combinations = itertools.product(versions, options)
      suffixes = list()
      if magick_suffix:
          suffixes = str(magick_suffix).split(";")
      # We need to convert the ``combinations`` generator to a list so we can
      # iterate over it twice.
      suffixes.extend(
          list(version + option for version, option in combinations)
      )
      if magick_home:
          # exhaustively search for libraries in magick_home before calling
          # find_library.
          for suffix in suffixes:
              # On Windows, the API is split between two libs. On other
              # platforms, it's all contained in one.
              if system == "Windows":
                  libwand = ("CORE_RL_wand_{0}.dll".format(suffix),)
                  libmagick = ("CORE_RL_magick_{0}.dll".format(suffix),)
                  yield magick_path(libwand), magick_path(libmagick)
                  libwand = (
                      "CORE_RL_MagickWand_{0}.dll".format(suffix),
                  )
                  libmagick = (
                      "CORE_RL_MagickCore_{0}.dll".format(suffix),
                  )
                  yield magick_path(libwand), magick_path(libmagick)
                  libwand = ("libMagickWand{0}.dll".format(suffix),)
                  libmagick = ("libMagickCore{0}.dll".format(suffix),)
                  yield magick_path(libwand), magick_path(libmagick)
              elif system == "Darwin":
                  libwand = (
                      "lib",
                      "libMagickWand{0}.dylib".format(suffix),
                  )
                  yield magick_path(libwand), magick_path(libwand)
              else:
                  libwand = (
                      "lib",
                      "libMagickWand{0}.so".format(suffix),
                  )
                  libmagick = (
                      "lib",
                      "libMagickCore{0}.so".format(suffix),
                  )
                  yield magick_path(libwand), magick_path(libmagick)
                  libwand = (
                      "lib",
                      "libMagickWand{0}.so.9".format(suffix),
                  )
                  libmagick = (
                      "lib",
                      "libMagickCore{0}.so.9".format(suffix),
                  )
                  yield magick_path(libwand), magick_path(libmagick)
                  libwand = (
                      "lib",
                      "libMagickWand{0}.so.6".format(suffix),
                  )
                  libmagick = (
                      "lib",
                      "libMagickCore{0}.so.6".format(suffix),
                  )
                  yield magick_path(libwand), magick_path(libmagick)
      for suffix in suffixes:
          if system == "Windows":
              libwand = ctypes.util.find_library(
                  "CORE_RL_wand_" + suffix
              )
              libmagick = ctypes.util.find_library(
                  "CORE_RL_magick_" + suffix
              )
              yield libwand, libmagick
              libwand = ctypes.util.find_library(
                  "CORE_RL_MagickWand_" + suffix
              )
              libmagick = ctypes.util.find_library(
                  "CORE_RL_MagickCore_" + suffix
              )
              yield libwand, libmagick
              libwand = ctypes.util.find_library(
                  "libMagickWand" + suffix
              )
              libmagick = ctypes.util.find_library(
                  "libMagickCore" + suffix
              )
              yield libwand, libmagick
          else:
              libmagick = ctypes.util.find_library(
                  "MagickCore" + suffix
              )
              libwand = ctypes.util.find_library("MagickWand" + suffix)
              if libmagick is not None:
                  yield libwand, libmagick
              yield libwand, libwand
  
file_path: wand/wand/api.py
imports: import ctypes
  import ctypes.util
  import itertools
  import os
  import os.path
  import platform
  import sys
  import traceback
  from .cdefs.structures import AffineMatrix, MagickPixelPacket, PixelInfo, PointInfo
label_desc: Use image node_id 1 for calling a global function with example usage: library_paths() and returns: os