code: def title_has_tag(page, lang, tag):
      
      from .models import TitleTags
      if hasattr(tag, 'slug'):
          slug = tag.slug
      else:
          slug = tag
      try:
          return page.get_title_obj(
              language=lang, fallback=False
          ).titletags.tags.filter(slug=slug).exists()
      except TitleTags.DoesNotExist:
          return False
docs: Check if a Title object is associated with the given tag.
      This function does not use fallbacks to retrieve title object.
  
      :param page: a Page instance
      :param lang: a language code
      :param tag: a Tag instance or a slug string.
  
      :return: whether the Title instance has the given tag attached (False if no Title or no
               attached TitleTags exists)
      :type: Boolean