class_docstr: Abstract base class for MagickWand object that requires resource
  management. Its all subclasses manage the resource semiautomatically
  and support :keyword:`with` statement as well::
  
      with Resource() as resource:
          # use the resource...
          pass
  
  It doesn't implement constructor by itself, so subclasses should
  implement it. Every constructor should assign the pointer of its
  resource data into :attr:`resource` attribute inside of :keyword:`with`
  :meth:`allocate()` context.  For example::
  
      class Pizza(Resource):
          '''My pizza yummy.'''
  
          def __init__(self):
              with self.allocate():
                  self.resource = library.NewPizza()
  
  .. versionadded:: 0.1.2
docstr: Gets a current exception instance.
  
  :returns: a current exception. it can be ``None`` as well if any
            errors aren't occurred
  :rtype: :class:`wand.exceptions.WandException`
docstr_tok: ["Gets","a","current","exception","instance",".",":","returns",":","a","current","exception",".","it","can","be","``","None","``","as","well","if","any","errors","are","n't","occurred",":","rtype",":",":","class",":","`","wand.exceptions.WandException","`"]
code: def get_exception(self):
      """Gets a current exception instance.
  
      :returns: a current exception. it can be ``None`` as well if any
                errors aren't occurred
      :rtype: :class:`wand.exceptions.WandException`
  
      """
      severity = ctypes.c_int()
      desc = self.c_get_exception(self.resource, ctypes.byref(severity))
      if severity.value == 0:
          if desc:
              desc = library.MagickRelinquishMemory(desc)
          return
      self.c_clear_exception(self.resource)
      exc_cls = TYPE_MAP[severity.value]
      if desc:
          message = ctypes.string_at(desc)
          desc = library.MagickRelinquishMemory(desc)
      else:
          message = b""
      if not isinstance(message, string_type):
          message = message.decode(errors="replace")
      return exc_cls(message)
  
imports: import atexit
  import contextlib
  import ctypes
  import warnings
  from .api import library
  from .compat import abc, string_type
  from .exceptions import TYPE_MAP, WandException
  from .version import MAGICK_VERSION_NUMBER
label_desc: Use image node_id 6 for calling the Resource obj's underlying member method code with example usage: obj.get_exception() and returns: exc_cls