'Create a drawing instance.
:param im: The image to draw in.
:param mode: Optional mode to use for color values.  For RGB
images, this argument can be RGB or RGBA (to blend the
drawing into the image).  For all other modes, this argument
must be the same as the image mode.  If omitted, the mode
defaults to the mode of the image.'

def __init__(self, im, mode=None):

    im.load()
    if im.readonly:
        im._copy()
    blend = 0
    if (mode is None):
        mode = im.mode
    if (mode != im.mode):
        if ((mode == 'RGBA') and (im.mode == 'RGB')):
            blend = 1
        else:
            raise ValueError('mode    mismatch')
    if (mode == 'P'):
        self.palette = im.palette
    else:
        self.palette = None
    self.im = im.im
    self.draw = Image.core.draw(self.im, blend)
    self.mode = mode
    if (mode in ('I', 'F')):
        self.ink = self.draw.draw_ink(1, mode)
    else:
        self.ink = self.draw.draw_ink((-1), mode)
    if (mode in ('1', 'P', 'I', 'F')):
        self.fontmode = '1'
    else:
        self.fontmode = 'L'
    self.fill = 0
    self.font = None
