code: def _tags_to_preslots(tags, tokens, is_start_of_slot, is_end_of_slot):
      slots = []
      current_slot_start = 0
      for i, tag in enumerate(tags):
          if is_start_of_slot(tags, i):
              current_slot_start = i
          if is_end_of_slot(tags, i):
              slots.append(
                  {
                      RANGE: {
                          START: tokens[current_slot_start].start,
                          END: tokens[i].end,
                      },
                      SLOT_NAME: tag_name_to_slot_name(tag),
                  }
              )
              current_slot_start = i
      return slots
  
imports: from __future__ import unicode_literals
  from builtins import range
  from enum import Enum, unique
  from snips_nlu.constants import END, SLOT_NAME, START, TEXT
  from snips_nlu.preprocessing import Token, tokenize
  from snips_nlu.result import unresolved_slot
label_desc: Use image node_id 8 for calling a global function with example usage: _tags_to_preslots(tags, tokens, is_start_of_slot, is_end_of_slot) and returns: slots