code: def get_groundings(entity):
          def get_grounding_entries(grounding):
              if not grounding:
                  return None
              entries = []
              values = grounding.get('values', [])
              if values:
                  for entry in values:
                      ont_concept = entry.get('ontologyConcept')
                      value = entry.get('value')
                      if ont_concept is None or value is None:
                          continue
                      entries.append((ont_concept, value))
              return entries
          db_refs = {'TEXT': entity['text']}
          groundings = entity.get('groundings')
          if not groundings:
              return db_refs
          for g in groundings:
              entries = get_grounding_entries(g)
              if entries:
                  key = g['name'].upper()
                  if key == 'UN':
                      db_refs[key] = [(s[0].replace(' ', '_'), s[1])
                                      for s in entries]
                  else:
                      db_refs[key] = entries
          return db_refs