code: def create_block_lexicon(
      block_tokens: List[str],
      vocab_target: vocab.Vocab,
      output_path: str,
      lowercase: bool = False,
  ):
      if lowercase:
          # Lowercase vocabulary entries + block words:
          # lowercased entries map to multiple word ids
          vocab_target_lower = collections.defaultdict(list)
          for k, v in vocab_target.items():
              vocab_target_lower[k.lower()].append(v)
          block_tokens = [token.lower() for token in block_tokens]
          vocab_target_for_lexicon = dict(vocab_target_lower)
      else:
          vocab_target_for_lexicon = {
              k: [v] for k, v in vocab_target.items()
          }
  
      lexicon = StaticBlockLexicon()
      lexicon.create(block_tokens, vocab_target_for_lexicon)
      lexicon.save(output_path)
  
imports: import argparse
  import collections
  import os
  import sys
  import time
  import logging
  from itertools import groupby
  from operator import itemgetter
  from typing import Dict, Generator, List, Tuple, Optional
  from abc import abstractmethod, ABC
  import numpy
  from sockeye.data_io import SequenceReader
  from .None import arguments
  from .None import constants
  from .None import vocab
  from .utils import smart_open, get_tokens
  from .log import setup_main_logger, log_sockeye_version
label_desc: Use image node_id 7 for calling a global function with example usage: create_block_lexicon(block_tokens, vocab_target, output_path, lowercase) without return types