class_docstr: A printer to convert expressions to strings of Julia code.
class_docstr_tok: ["A","printer","to","convert","expressions","to","strings","of","Julia","code","."]
docstr: Accepts a string of code or a list of code lines
code: def indent_code(self, code):
      """Accepts a string of code or a list of code lines"""
  
      # code mostly copied from ccode
      if isinstance(code, str):
          code_lines = self.indent_code(code.splitlines(True))
          return "".join(code_lines)
  
      tab = "    "
      inc_regex = ("^function ", "^if ", "^elseif ", "^else$", "^for ")
      dec_regex = ("^end$", "^elseif ", "^else$")
  
      # pre-strip left-space from the code
      code = [line.lstrip(" \t") for line in code]
  
      increase = [
          int(any(search(re, line) for re in inc_regex))
          for line in code
      ]
      decrease = [
          int(any(search(re, line) for re in dec_regex))
          for line in code
      ]
  
      pretty = []
      level = 0
      for n, line in enumerate(code):
          if line in ("", "\n"):
              pretty.append(line)
              continue
          level -= decrease[n]
          pretty.append("%s%s" % (tab * level, line))
          level += increase[n]
      return pretty
  
imports: from __future__ import annotations
  from typing import Any
  from sympy.core import Mul, Pow, S, Rational
  from sympy.core.mul import _keep_coeff
  from sympy.core.numbers import equal_valued
  from sympy.printing.codeprinter import CodePrinter
  from sympy.printing.precedence import precedence, PRECEDENCE
  from re import search
label_desc: Use image node_id 42 for calling the JuliaCodePrinter obj's underlying member method code with example usage: obj.indent_code(code) and returns: pretty, str