code: def capture_slot(state):
      next_colon_pos = state.find(":")
      next_square_bracket_pos = state.find("]")
      if next_square_bracket_pos < 0:
          raise IntentFormatError(
              "Missing ending ']' in annotated utterance \"%s\""
              % state.input
          )
      if next_colon_pos < 0 or next_square_bracket_pos < next_colon_pos:
          slot_name = state[:next_square_bracket_pos]
          state.move(next_square_bracket_pos)
          state.add_slot(slot_name)
      else:
          slot_name = state[:next_colon_pos]
          state.move(next_colon_pos)
          entity = state[:next_square_bracket_pos]
          state.move(next_square_bracket_pos)
          state.add_slot(slot_name, entity)
      if state.peek() == "(":
          state.read()
          capture_tagged(state)
      else:
          capture_text(state)
  
imports: from __future__ import absolute_import, print_function, unicode_literals
  from abc import ABCMeta, abstractmethod
  from builtins import object
  from io import IOBase
  from future.utils import with_metaclass
  from snips_nlu.constants import DATA, ENTITY, SLOT_NAME, TEXT, UTTERANCES
  from snips_nlu.exceptions import IntentFormatError
label_desc: Use image node_id 2 for calling a global function with example usage: capture_slot(state) without return types