docs: def count_entities_or_keys(self, *args, forward=None):
          """Return the number of keys an entity has, if you specify an entity.
  
          Otherwise return the number of entities.
  
          """
          if forward is None:
              forward = self.db._forward
          entity = args[:-3]
          branch, turn, tick = args[-3:]
          if self.db._no_kc:
              return len(self._get_adds_dels(self.keys[entity], branch, turn, tick)[0])
          return len(self._get_keycache(entity, branch, turn, tick, forward=forward))