code: def _get_record_fields(d):
      
      if isinstance(d, dict):
          if "fields" in d:
              return d["fields"]
          else:
              for v in d.values():
                  fields = _get_record_fields(v)
                  if fields:
                      return fields
docs: Get field names from a potentially nested record.