class_docstr: Translates Instruction bytecode to a polars expression string.
class_docstr_tok: ["Translates","Instruction","bytecode","to","a","polars","expression","string","."]
docstr: Take postfix bytecode and convert to an intermediate natural-order stack.
code: def _to_intermediate_stack(
      self, instructions: list[Instruction], map_target: MapTarget
  ) -> StackEntry:
      """Take postfix bytecode and convert to an intermediate natural-order stack."""
      if map_target in ("expr", "series"):
          stack: list[StackEntry] = []
          for inst in instructions:
              stack.append(
                  inst.argrepr
                  if inst.opname in OpNames.LOAD
                  else (
                      StackValue(
                          operator=self.op(inst),
                          operator_arity=1,
                          left_operand=stack.pop(),  # type: ignore[arg-type]
                          right_operand=None,  # type: ignore[arg-type]
                      )
                      if (
                          inst.opname in OpNames.UNARY
                          or OpNames.SYNTHETIC.get(inst.opname) == 1
                      )
                      else StackValue(
                          operator=self.op(inst),
                          operator_arity=2,
                          left_operand=stack.pop(-2),  # type: ignore[arg-type]
                          right_operand=stack.pop(-1),  # type: ignore[arg-type]
                      )
                  )
              )
          return stack[0]
  
      # TODO: dataframe.apply(...)
      raise NotImplementedError(f"TODO: {map_target!r} apply")
  
imports: from __future__ import annotations
  import datetime
  import dis
  import inspect
  import re
  import sys
  import warnings
  from bisect import bisect_left
  from collections import defaultdict
  from dis import get_instructions
  from inspect import signature
  from itertools import count, zip_longest
  from pathlib import Path
  from typing import TYPE_CHECKING, AbstractSet, Any, Callable, ClassVar, Iterator, Literal, NamedTuple, Union
label_desc: Use image node_id 5 for calling the InstructionTranslator obj's underlying member method code with example usage: obj._to_intermediate_stack(instructions, map_target) and returns: stack