def _AdjustAperture(self, amount):
    """Adjusts the load average of the pool, and adjusts the aperture size
    if required by the new load average.

    Args:
      amount - The amount to change the load by.  May be +/-1
    """
    self._total += amount
    avg = self._ema.Update(self._time.Sample(), self._total)
    aperture_size = self._size
    if aperture_size == 0:
      # Essentially infinite load.
      aperture_load = self._max_load
    else:
      aperture_load = avg / aperture_size
      self.__varz.load_average(aperture_load)
    if (aperture_load >= self._max_load
        and self._idle_endpoints
        and aperture_size < self._max_size):
      self._TryExpandAperture()
    elif aperture_load <= self._min_load and aperture_size > self._min_size:
      self._ContractAperture()
dataset/ETHPy150Open steveniemitz/scales/scales/loadbalancer/aperture.py/ApertureBalancerSink._AdjustAperture/original