code: def load_from_db(self, cache=False):
          
          a = {}
          db_prefs = {p.preference.identifier(): p for p in self.queryset}
          for preference in self.registry.preferences():
              try:
                  db_pref = db_prefs[preference.identifier()]
              except KeyError:
                  db_pref = self.create_db_pref(
                      section=preference.section.name,
                      name=preference.name,
                      value=preference.get('default'))
              else:
                  # cache if create_db_pref() hasn't already done so
                  if cache:
                      self.to_cache(db_pref)
  
              a[preference.identifier()] = db_pref.value
  
          return a
docs: Return a dictionary of preferences by section directly from DB