'Update the label position based on the bounding box enclosing
all the ticklabels and axis spine'

def _update_label_position(self, bboxes, bboxes2):

    if (not self._autolabelpos):
        return
    (x, y) = self.label.get_position()
    if (self.label_position == u'left'):
        try:
            spine = self.axes.spines[u'left']
            spinebbox = spine.get_transform().transform_path(spine.get_path()).get_extents()
        except KeyError:
            spinebbox = self.axes.bbox
        bbox = mtransforms.Bbox.union((bboxes + [spinebbox]))
        left = bbox.x0
        self.label.set_position(((left - ((self.labelpad * self.figure.dpi) / 72.0)), y))
    else:
        try:
            spine = self.axes.spines[u'right']
            spinebbox = spine.get_transform().transform_path(spine.get_path()).get_extents()
        except KeyError:
            spinebbox = self.axes.bbox
        bbox = mtransforms.Bbox.union((bboxes2 + [spinebbox]))
        right = bbox.x1
        self.label.set_position(((right + ((self.labelpad * self.figure.dpi) / 72.0)), y))
