code: def formats(pattern="*"):
      """
      Queries ImageMagick library for supported formats.
  
      Example: List supported PNG formats::
  
          >>> from wand.version import formats
          >>> formats('PNG*')
          ['PNG', 'PNG00', 'PNG8', 'PNG24', 'PNG32', 'PNG48', 'PNG64']
  
  
      :param pattern: A term to filter formats against. Supports wildcards '*'
                      characters. Default pattern '*' for all formats.
      :type pattern: :class:`basestring`
      :returns: Sequence of matching formats
      :rtype: :class:`collections.Sequence`
      """
      if not isinstance(pattern, string_type):
          raise TypeError(
              "pattern must be a string, not " + repr(pattern)
          )
      # We must force init environment to load user config paths.
      library.MagickWandGenesis()
      pattern_p = ctypes.create_string_buffer(binary(pattern))
      number_formats = ctypes.c_size_t(0)
      formats = []
      formats_p = library.MagickQueryFormats(
          pattern_p, ctypes.byref(number_formats)
      )
      for cursor in range(number_formats.value):
          value = ctypes.string_at(formats_p[cursor])
          formats.append(text(value))
      if formats_p:
          formats_p = library.MagickRelinquishMemory(formats_p)
      return formats
  
file_path: wand/wand/version.py
imports: from __future__ import print_function
  import ctypes
  import datetime
  import re
  import sys
  from .compat import binary, string_type, text
label_desc: Use image node_id 3 for calling a global function with example usage: formats(pattern) and returns: formats