'automatically set spine bounds to the view interval'

def _adjust_location(self):

    if (self.spine_type == u'circle'):
        return
    if (self._bounds is None):
        if (self.spine_type in (u'left', u'right')):
            (low, high) = self.axes.viewLim.intervaly
        elif (self.spine_type in (u'top', u'bottom')):
            (low, high) = self.axes.viewLim.intervalx
        else:
            raise ValueError((u'unknown    spine    spine_type:    %s' % self.spine_type))
        if self._smart_bounds:
            (viewlim_low, viewlim_high) = sorted([low, high])
            if (self.spine_type in (u'left', u'right')):
                (datalim_low, datalim_high) = self.axes.dataLim.intervaly
                ticks = self.axes.get_yticks()
            elif (self.spine_type in (u'top', u'bottom')):
                (datalim_low, datalim_high) = self.axes.dataLim.intervalx
                ticks = self.axes.get_xticks()
            ticks = np.sort(ticks)
            (datalim_low, datalim_high) = sorted([datalim_low, datalim_high])
            if (datalim_low < viewlim_low):
                low = viewlim_low
            else:
                cond = ((ticks <= datalim_low) & (ticks >= viewlim_low))
                tickvals = ticks[cond]
                if len(tickvals):
                    low = tickvals[(-1)]
                else:
                    low = datalim_low
                low = max(low, viewlim_low)
            if (datalim_high > viewlim_high):
                high = viewlim_high
            else:
                cond = ((ticks >= datalim_high) & (ticks <= viewlim_high))
                tickvals = ticks[cond]
                if len(tickvals):
                    high = tickvals[0]
                else:
                    high = datalim_high
                high = min(high, viewlim_high)
    else:
        (low, high) = self._bounds
    v1 = self._path.vertices
    assert (v1.shape == (2, 2)), u'unexpected    vertices    shape'
    if (self.spine_type in [u'left', u'right']):
        v1[(0, 1)] = low
        v1[(1, 1)] = high
    elif (self.spine_type in [u'bottom', u'top']):
        v1[(0, 0)] = low
        v1[(1, 0)] = high
    else:
        raise ValueError((u'unable    to    set    bounds    for    spine    "%s"' % self.spine_type))
