code: def bilou_tags_to_ids(
      message: "Message",
      tag_id_dict: Dict[Text, int],
      tag_name: Text = ENTITY_ATTRIBUTE_TYPE,
  ) -> List[int]:
      """Maps the entity tags of the message to the ids of the provided dict.
  
      Args:
          message: the message
          tag_id_dict: mapping of tags to ids
          tag_name: tag name of interest
  
      Returns: a list of tag ids
      """
      bilou_key = get_bilou_key_for_tag(tag_name)
  
      if message.get(bilou_key):
          _tags = [
              tag_id_dict[_tag]
              if _tag in tag_id_dict
              else tag_id_dict[NO_ENTITY_TAG]
              for _tag in message.get(bilou_key)
          ]
      else:
          _tags = [
              tag_id_dict[NO_ENTITY_TAG]
              for _ in message.get(TOKENS_NAMES[TEXT])
          ]
  
      return _tags
  
imports: import logging
  import operator
  from collections import defaultdict, Counter
  from typing import List, Tuple, Text, Optional, Dict, Any, TYPE_CHECKING
  from rasa.nlu.constants import TOKENS_NAMES, BILOU_ENTITIES, BILOU_ENTITIES_GROUP, BILOU_ENTITIES_ROLE
  from rasa.shared.nlu.constants import TEXT, ENTITIES, ENTITY_ATTRIBUTE_START, ENTITY_ATTRIBUTE_END, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_GROUP, ENTITY_ATTRIBUTE_ROLE, NO_ENTITY_TAG
label_desc: Use image node_id 3 for calling a global function with example usage: bilou_tags_to_ids(message, tag_id_dict, tag_name) and returns: _tags