'Set the visible range of the ViewBox.
Must specify at least one of *rect*, *xRange*, or *yRange*.
**Arguments:**
*rect*             (QRectF) The full range that should be visible in the view box.
*xRange*           (min,max) The range that should be visible along the x-axis.
*yRange*           (min,max) The range that should be visible along the y-axis.
*padding*          (float) Expand the view by a fraction of the requested range.
By default, this value is set between 0.02 and 0.1 depending on
the size of the ViewBox.
*update*           (bool) If True, update the range of the ViewBox immediately.
Otherwise, the update is deferred until before the next render.
*disableAutoRange* (bool) If True, auto-ranging is diabled. Otherwise, it is left
unchanged.'

def setRange(self, rect=None, xRange=None, yRange=None, padding=None, update=True, disableAutoRange=True):

    changes = {}
    setRequested = [False, False]
    if (rect is not None):
        changes = {0: [rect.left(), rect.right()], 1: [rect.top(), rect.bottom()]}
        setRequested = [True, True]
    if (xRange is not None):
        changes[0] = xRange
        setRequested[0] = True
    if (yRange is not None):
        changes[1] = yRange
        setRequested[1] = True
    if (len(changes) == 0):
        print rect
        raise Exception(('Must    specify    at    least    one    of    rect,    xRange,    or    yRange.    (gave    rect=%s)' % str(type(rect))))
    changed = [False, False]
    for (ax, range) in changes.items():
        mn = min(range)
        mx = max(range)
        if (mn == mx):
            dy = (self.state['viewRange'][ax][1] - self.state['viewRange'][ax][0])
            if (dy == 0):
                dy = 1
            mn -= (dy * 0.5)
            mx += (dy * 0.5)
            xpad = 0.0
        if (not all(np.isfinite([mn, mx]))):
            raise Exception(('Cannot    set    range    [%s,    %s]' % (str(mn), str(mx))))
        if (padding is None):
            xpad = self.suggestPadding(ax)
        else:
            xpad = padding
        p = ((mx - mn) * xpad)
        mn -= p
        mx += p
        if (self.state['targetRange'][ax] != [mn, mx]):
            self.state['targetRange'][ax] = [mn, mx]
            changed[ax] = True
    (lockX, lockY) = setRequested
    if (lockX and lockY):
        lockX = False
        lockY = False
    self.updateViewRange(lockX, lockY)
    if disableAutoRange:
        xOff = (False if setRequested[0] else None)
        yOff = (False if setRequested[1] else None)
        self.enableAutoRange(x=xOff, y=yOff)
        changed.append(True)
    if any(changed):
        self.sigStateChanged.emit(self)
        if self.target.isVisible():
            self.target.setRect(self.mapRectFromItem(self.childGroup, self.targetRect()))
    if (changed[0] and self.state['autoVisibleOnly'][1] and (self.state['autoRange'][0] is not False)):
        self._autoRangeNeedsUpdate = True
    elif (changed[1] and self.state['autoVisibleOnly'][0] and (self.state['autoRange'][1] is not False)):
        self._autoRangeNeedsUpdate = True
