code: def get_concepts_to_recalculate(self, users, lang, concepts=None):
          only_one_user = False
          if not isinstance(users, list):
              only_one_user = True
              users = [users]
          mapping = self.get_item_concept_mapping(lang)
          current_user_stats = defaultdict(lambda: {})
          user_stats_qs = UserStat.objects.filter(user__in=users, stat="answer_count")
          if concepts is not None:
              user_stats_qs = user_stats_qs.filter(concept__in=concepts)
          for user_stat in user_stats_qs:
              current_user_stats[user_stat.user_id][user_stat.concept_id] = user_stat
          concepts_to_recalculate = defaultdict(lambda: set())
          for user, item, time in Answer.objects.filter(user__in=users)\
                  .values_list("user_id", "item").annotate(Max("time")):
              if item not in mapping:
                  continue
              time_expiration_lower_bound = get_config('proso_models', 'knowledge_overview.time_shift_hours', default=4)
              time_expiration_factor = get_config('proso_models', 'knowledge_overview.time_expiration_factor', default=2)
              for concept in mapping[item]:
                  if user in current_user_stats and concept in current_user_stats[user] \
                          and current_user_stats[user][concept].time > time:
                      if not self.has_time_expired(current_user_stats[user][concept].time, time, time_expiration_lower_bound, time_expiration_factor):
                          continue
                  if concepts is None or concept in ([c.pk for c in concepts] if type(concepts[0]) == Concept else Concept):
                      concepts_to_recalculate[user].add(concept)
          if only_one_user:
              return concepts_to_recalculate[users[0]]
          return concepts_to_recalculate