'get the spine transform'

def get_spine_transform(self):

    self._ensure_position_is_set()
    (what, how) = self._spine_transform
    if (what == u'data'):
        data_xform = (self.axes.transScale + ((how + self.axes.transLimits) + self.axes.transAxes))
        if (self.spine_type in [u'left', u'right']):
            result = mtransforms.blended_transform_factory(data_xform, self.axes.transData)
        elif (self.spine_type in [u'top', u'bottom']):
            result = mtransforms.blended_transform_factory(self.axes.transData, data_xform)
        else:
            raise ValueError((u'unknown    spine    spine_type:    %s' % self.spine_type))
        return result
    if (self.spine_type in [u'left', u'right']):
        base_transform = self.axes.get_yaxis_transform(which=u'grid')
    elif (self.spine_type in [u'top', u'bottom']):
        base_transform = self.axes.get_xaxis_transform(which=u'grid')
    else:
        raise ValueError((u'unknown    spine    spine_type:    %s' % self.spine_type))
    if (what == u'identity'):
        return base_transform
    elif (what == u'post'):
        return (base_transform + how)
    elif (what == u'pre'):
        return (how + base_transform)
    else:
        raise ValueError((u'unknown    spine_transform    type:    %s' % what))
