code: def where_entry_tag(query, tag):
      
      if isinstance(tag, (list, set, tuple)):
          tags = [t.lower() for t in tag]
          return orm.select(e for e in query for t in e.tags if t.key in tags)
      return orm.select(e for e in query for t in e.tags if t.key == tag.lower())
docs: Generate a where clause for entries with the given tag