code: def create_rot_n(n) -> List[Instruction]:
      """
      Returns a "simple" sequence of instructions that rotates TOS to the n-th
      position in the stack. For Python < 3.11, returns a single ROT_*
      instruction. If no such instruction exists, an error is raised and the
      caller is expected to generate an equivalent sequence of instructions.
      For Python >= 3.11, any rotation can be expressed as a simple sequence of
      swaps.
      """
      if n <= 1:
          # don't rotate
          return []
  
      if sys.version_info >= (3, 11):
          # rotate can be expressed as a sequence of swap operations
          # e.g. rotate 3 is equivalent to swap 3, swap 2
          return [
              create_instruction("SWAP", arg=i) for i in range(n, 1, -1)
          ]
  
      # ensure desired rotate function exists
      if sys.version_info < (3, 8) and n >= 4:
          raise AttributeError(
              f"rotate {n} not supported for Python < 3.8"
          )
      if sys.version_info < (3, 10) and n >= 5:
          raise AttributeError(
              f"rotate {n} not supported for Python < 3.10"
          )
  
      if n <= 4:
          return [
              create_instruction(
                  "ROT_" + ["TWO", "THREE", "FOUR"][n - 2]
              )
          ]
      return [create_instruction("ROT_N", arg=n)]
  
imports: import copy
  import dataclasses
  import dis
  import itertools
  import sys
  import types
  from typing import Any, Callable, cast, Dict, Iterator, List, Optional, Tuple
  from .bytecode_analysis import get_indexof, propagate_line_nums, remove_extra_line_nums, stacksize_analysis
label_desc: Use image node_id 6 for calling a global function with example usage: create_rot_n(n) and returns: list, list, unknown, list