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: Allocates the memory for the resource explicitly. Its subclasses
  should assign the created resource into :attr:`resource` attribute
  inside of this context. For example::
  
      with resource.allocate():
          resource.resource = library.NewResource()
docstr_tok: ["Allocates","the","memory","for","the","resource","explicitly",".","Its","subclasses","should","assign","the","created","resource","into",":","attr",":","`","resource","`","attribute","inside","of","this","context",".","For","example",":",":","with","resource.allocate","(",")",":","resource.resource","=","library.NewResource","(",")"]
code: def allocate(self):
      """Allocates the memory for the resource explicitly. Its subclasses
      should assign the created resource into :attr:`resource` attribute
      inside of this context. For example::
  
          with resource.allocate():
              resource.resource = library.NewResource()
  
      """
      # As of 0x710, we must call MagickWandGenesis before allocate of
      # Wand's Resource & ImageMagick PixelWand.
      genesis()
      yield self
  
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 4 for calling the Resource obj's underlying member method code with example usage: obj.allocate() without return types