docs: def _get_bounds(self, ib, dimension):
          """ib == 0/1 means lower/upper bound, return a vector of length
          `dimension` """
          sign_ = 2 * ib - 1
          assert sign_**2 == 1
          if self.bounds is None or self.bounds[ib] is None:
              return array(dimension * [sign_ * np.Inf])
          res = []
          for i in xrange(dimension):
              res.append(self.bounds[ib][min([i, len(self.bounds[ib]) - 1])])
              if res[-1] is None:
                  res[-1] = sign_ * np.Inf
          return array(res)