docs: def page_has_tag(page, tag):
      """
      Check if a Page object is associated with the given tag.
  
      :param page: a Page instance
      :param tag: a Tag instance or a slug string.
  
      :return: whether the Page instance has the given tag attached (False if no Page or no
               attached PageTags exists)
      :type: Boolean
      """
      from .models import PageTags
      if hasattr(tag, 'slug'):
          slug = tag.slug
      else:
          slug = tag
      try:
          return page.pagetags.tags.filter(slug=slug).exists()
      except PageTags.DoesNotExist:
          return False