'Manages the correct rendering of the turtle with respect to
its shape, resizemode, stretch and tilt etc.'

def _drawturtle(self):

    screen = self.screen
    shape = screen._shapes[self.turtle.shapeIndex]
    ttype = shape._type
    titem = self.turtle._item
    if (self._shown and (screen._updatecounter == 0) and (screen._tracing > 0)):
        self._hidden_from_screen = False
        tshape = shape._data
        if (ttype == 'polygon'):
            if (self._resizemode == 'noresize'):
                w = 1
            elif (self._resizemode == 'auto'):
                w = self._pensize
            else:
                w = self._outlinewidth
            shape = self._polytrafo(self._getshapepoly(tshape))
            (fc, oc) = (self._fillcolor, self._pencolor)
            screen._drawpoly(titem, shape, fill=fc, outline=oc, width=w, top=True)
        elif (ttype == 'image'):
            screen._drawimage(titem, self._position, tshape)
        elif (ttype == 'compound'):
            for (item, (poly, fc, oc)) in zip(titem, tshape):
                poly = self._polytrafo(self._getshapepoly(poly, True))
                screen._drawpoly(item, poly, fill=self._cc(fc), outline=self._cc(oc), width=self._outlinewidth, top=True)
    else:
        if self._hidden_from_screen:
            return
        if (ttype == 'polygon'):
            screen._drawpoly(titem, ((0, 0), (0, 0), (0, 0)), '', '')
        elif (ttype == 'image'):
            screen._drawimage(titem, self._position, screen._shapes['blank']._data)
        elif (ttype == 'compound'):
            for item in titem:
                screen._drawpoly(item, ((0, 0), (0, 0), (0, 0)), '', '')
        self._hidden_from_screen = True
