docs: def allow_resource_access(self, resource_name, when=None):
          """
          meterer.allow_resource_access(resource_name, when=None) -> bool
  
          Indicate whether access to the specified resource should be allowed.
          This checks the limit(s) for the pool associated with the resource and
          records the attempt. If the attempt falls below the limit, the allowance
          is also recorded and True is returned. Otherwise, False is returned.
  
          If when is None (the default), it defaults to the current time. This is
          used for testing.
          """
          # The period strings of interest to us
          period_strs = self.get_period_strs(when)
  
          # Get the pool and limits for the pool.
          pool = self.pool_for_resource(resource_name)
          limits = self.get_limits_for_pool(pool)
  
          resource_size = self.resource_size(resource_name)
  
          # Record the access attempt.
          for period, period_str in period_strs.items():
              aggregate_size = self.cache.incrbyfloat(
                  "ATTEMPT:%s:%s" % (period_str, pool), resource_size)
              log.debug("allow_resource_access(%r): ATTEMPT:%s:%s=%s",
                        resource_name, period_str, pool, aggregate_size)
  
          del period_str
  
          # A list of things we need to undo from Redis if we breach a limit.
          undo_actions = []
  
          # Check for limit breaches.
          for period, period_str in period_strs.items():
              limit = limits.get(period)
              key = "ALLOWED:%s:%s" % (period_str, pool)
              result = self.cache.incrbyfloat(key, resource_size)
              undo_actions.append((key, -resource_size))
              log.debug("allow_resource_access(%r): ALLOWED:%s:%s=%s",
                        resource_name, period_str, pool, result)
  
              if limit and result > limit:
                  log.debug("allow_resource_access(%r): Limit %s would be "
                            "breached: limit=%s, result=%s", resource_name,
                            period, limit, result)
  
                  for key, incr in undo_actions:
                      self.cache.incrbyfloat(key, incr)
  
                  return False
  
          log.debug("allow_resource_access(%r): No limits breached; allowed",
                    resource_name)
          return True