code: def _setup_constants(alphabet=NAMESPACE_CHARACTERS,
                       max_length=MAX_NAMESPACE_LENGTH,
                       batch_size=NAMESPACE_BATCH_SIZE):
    
  
    global NAMESPACE_CHARACTERS
    global MAX_NAMESPACE_LENGTH
    # pylint: disable=global-variable-undefined
    global MAX_NAMESPACE
    global _LEX_DISTANCE
    global NAMESPACE_BATCH_SIZE
  
    NAMESPACE_CHARACTERS = alphabet
    MAX_NAMESPACE_LENGTH = max_length
    MAX_NAMESPACE = NAMESPACE_CHARACTERS[-1] * MAX_NAMESPACE_LENGTH
    NAMESPACE_BATCH_SIZE = batch_size
  
    # _LEX_DISTANCE will contain the lexical distance between two adjacent
    # characters in NAMESPACE_CHARACTERS at each character index. This is used
    # to calculate the ordinal for each string. Example:
    # NAMESPACE_CHARACTERS = 'ab'
    # MAX_NAMESPACE_LENGTH = 3
    # _LEX_DISTANCE = [1, 3, 7]
    # ''    => 0
    # 'a'   => 1
    # 'aa'  => 2
    # 'aaa' => 3
    # 'aab' => 4 - Distance between 'aaa' and 'aab' is 1.
    # 'ab'  => 5 - Distance between 'aa' and 'ab' is 3.
    # 'aba' => 6
    # 'abb' => 7
    # 'b'   => 8 - Distance between 'a' and 'b' is 7.
    # 'ba'  => 9
    # 'baa' => 10
    # 'bab' => 11
    # ...
    # _namespace_to_ord('bab') = (1 * 7 + 1) + (0 * 3 + 1) + (1 * 1 + 1) = 11
    _LEX_DISTANCE = [1]
    for i in range(1, MAX_NAMESPACE_LENGTH):
      _LEX_DISTANCE.append(
          _LEX_DISTANCE[i-1] * len(NAMESPACE_CHARACTERS) + 1)
    # pylint: disable=undefined-loop-variable
    del i
docs: Calculate derived constant values. Only useful for testing.