code: def localize(self, lng: str) -> str:
          
          if self.data is None:
              return ""
  
          if isinstance(self.data, dict):
              firstpart = lng.split('-')[0]
              similar = [l for l in self.data.keys() if (l.startswith(firstpart + "-") or firstpart == l) and l != lng]
              if self.data.get(lng):
                  return self.data[lng]
              elif self.data.get(firstpart):
                  return self.data[firstpart]
              elif similar and any([self.data.get(s) for s in similar]):
                  for s in similar:
                      if self.data.get(s):
                          return self.data.get(s)
              elif self.data.get(settings.LANGUAGE_CODE):
                  return self.data[settings.LANGUAGE_CODE]
              elif len(self.data):
                  return list(self.data.items())[0][1]
              else:
                  return ""
          else:
              return str(self.data)
docs: Evaluate the given string with respect to the locale defined by ``lng``.
  
          If no string is available in the currently active language, this will give you
          the string in the system's default language. If this is unavailable as well, it
          will give you the string in the first language available.
  
          :param lng: A locale code, e.g. ``de``. If you specify a code including a country
              or region like ``de-AT``, exact matches will be used preferably, but if only
              a ``de`` or ``de-AT`` translation exists, this might be returned as well.