def __call__(self, units=<NUM_LIT:1>, waits=True, context=None):
self._load_state(context)<EOL>state_changed = True<EOL>now = timestamp_ms.now()<EOL>if self.window is None:<EOL><INDENT>self.window = now<EOL><DEDENT>elif self.window + self.__window_size < now:<EOL><INDENT>self.window = now<EOL>self.count = <NUM_LIT:0><EOL><DEDENT>if self.count + units <= self.__calls_per_window:<EOL><INDENT>self.count += units<EOL>eax = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>eax = (self.window + self.__window_size - now) / <NUM_LIT><EOL>state_changed = False<EOL><DEDENT>self._save_state(state_changed, context)<EOL>if waits and eax != <NUM_LIT:0>:<EOL><INDENT>LOGGER.debug('<STR_LIT>', eax)<EOL>time.sleep(eax)<EOL><DEDENT>return eax<EOL>
To be called before consuming a resource that is subject to rate-limits.

        :param units:
          Number of units consumed by the API call that is about to be made.

        :param waits:
          If enable, then the member functions explictely calls `time.sleep`
          with the appropriate duration.

        :return:
          duration in seconds to wait for in order to stay under
          the rate limits policy
        :rtype: int