code: def block_program(self, chooser, description):
      """Mini-DSL for block rewriting. A sequence of commands that will be run
      over all contiguous sequences of blocks of the description length in order.
      Commands are:
  
          * ".", keep this block unchanged
          * "-", subtract one from this block.
          * "0", replace this block with zero
          * "X", delete this block
  
      If a command does not apply (currently only because it's - on a zero
      block) the block will be silently skipped over. As a side effect of
      running a block program its score will be updated.
      """
      n = len(description)
  
      """Adaptively attempt to run the block program at the current
      index. If this successfully applies the block program ``k`` times
      then this runs in ``O(log(k))`` test function calls."""
      i = chooser.choose(range(len(self.shrink_target.blocks) - n))
      # First, run the block program at the chosen index. If this fails,
      # don't do any extra work, so that failure is as cheap as possible.
      if not self.run_block_program(
          i, description, original=self.shrink_target
      ):
          return
  
      # Because we run in a random order we will often find ourselves in the middle
      # of a region where we could run the block program. We thus start by moving
      # left to the beginning of that region if possible in order to to start from
      # the beginning of that region.
      def offset_left(k):
          return i - k * n
  
      i = offset_left(
          find_integer(
              lambda k: self.run_block_program(
                  offset_left(k),
                  description,
                  original=self.shrink_target,
              )
          )
      )
  
      original = self.shrink_target
  
      # Now try to run the block program multiple times here.
      find_integer(
          lambda k: self.run_block_program(
              i, description, original=original, repeats=k
          )
      )
  
imports: from collections import defaultdict
  from typing import TYPE_CHECKING, Callable, Dict, Optional
  import attr
  from hypothesis.internal.compat import int_from_bytes, int_to_bytes
  from hypothesis.internal.conjecture.choicetree import ChoiceTree, prefix_selection_order, random_selection_order
  from hypothesis.internal.conjecture.data import DRAW_FLOAT_LABEL, ConjectureData, ConjectureResult, Status
  from hypothesis.internal.conjecture.dfa import ConcreteDFA
  from hypothesis.internal.conjecture.floats import float_to_lex, lex_to_float
  from hypothesis.internal.conjecture.junkdrawer import binary_search, find_integer, replace_all
  from hypothesis.internal.conjecture.shrinking import Float, Integer, Lexical, Ordering
  from hypothesis.internal.conjecture.shrinking.learned_dfas import SHRINKING_DFAS
label_desc: Use image node_id 4 for calling a global function with example usage: block_program(chooser, description) and returns: unknown