code: def _log_every_n_to_logger(n, logger, level, message, *args):  # pylint: disable=invalid-name
    
    logger = logger or logging.getLogger()
    def _gen():  # pylint: disable=missing-docstring
      while True:
        for _ in range(n):
          yield False
        logger.log(level, message, *args)
        yield True
    gen = _gen()
    return lambda: six.next(gen)
docs: Logs the given message every n calls to a logger.
  
    Args:
      n: Number of calls before logging.
      logger: The logger to which to log.
      level: The logging level (e.g. logging.INFO).
      message: A message to log
      *args: Any format args for the message.
    Returns:
      A method that logs and returns True every n calls.