docs: def get_page_from_string_or_id(page_string, lang=None):
      """Return a Page object from a slug or an id."""
      if type(page_string) == int:
          return Page.objects.get(pk=int(page_string))
      # if we have a string coming from some templates templates
      if (isinstance(page_string, SafeText) or
              isinstance(page_string, str)):
          if page_string.isdigit():
              return Page.objects.get(pk=int(page_string))
          return Page.objects.from_path(page_string, lang)
      # in any other case we return the input becasue it's probably
      # a Page object.
      return page_string