def _TryExpandAperture(self, leave_pending=False):
    """Attempt to expand the aperture.  By calling this it's assumed the aperture
    needs to be expanded.

    The aperture can be expanded if there are idle sinks available.
    """
    endpoints = list(self._idle_endpoints)
    added_node = None
    new_endpoint = None
    if endpoints:
      new_endpoint = random.choice(endpoints)
      self._idle_endpoints.discard(new_endpoint)
      self._log.debug(str(new_endpoint) % 'Expanding aperture to include %s.')
      new_sink = self._servers[new_endpoint]
      self._pending_endpoints.add(new_endpoint)
      added_node = super(ApertureBalancerSink, self)._AddSink(new_endpoint, new_sink)

    self._UpdateSizeVarz()
    if added_node:
      if not leave_pending:
        added_node.ContinueWith(
            lambda ar: self._pending_endpoints.discard(new_endpoint))
      return added_node, new_endpoint
    else:
      return AsyncResult.Complete(), None
dataset/ETHPy150Open steveniemitz/scales/scales/loadbalancer/aperture.py/ApertureBalancerSink._TryExpandAperture/swapped operands of `%`