code: def prefix_selection_order(
      prefix: Sequence[int],
  ) -> Callable[[int, int], Iterable[int]]:
      """Select choices starting from ``prefix```,
      preferring to move left then wrapping around
      to the right."""
  
      def selection_order(depth: int, n: int) -> Iterable[int]:
          if depth < len(prefix):
              i = prefix[depth]
              if i >= n:
                  i = n - 1
              yield from range(i, -1, -1)
              yield from range(n - 1, i, -1)
          else:
              yield from range(n - 1, -1, -1)
  
      return selection_order
  
file_path: catboost/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/choicetree.py
imports: from collections import defaultdict
  from random import Random
  from typing import Callable, Dict, Iterable, List, Optional, Sequence
  from hypothesis.internal.conjecture.junkdrawer import LazySequenceCopy, pop_random
label_desc: Use image node_id 1 for calling a global function with example usage: prefix_selection_order(prefix) and returns: selection_order