<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _log_every_n_to_logger(n, logger, level, message, *args):
 # pylint: disable=invalid-name """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. """

  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)