code: def solve_triangular(A, b, lower=False, no_crash=False):
      """Solve a triangular linear system Ax = b for x.
  
      Parameters
      ----------
      A : :class:`.NDArrayNumericExpression`, (N, N)
          Triangular coefficient matrix.
      b : :class:`.NDArrayNumericExpression`, (N,) or (N, K)
          Dependent variables.
      lower : `bool`:
          If true, A is interpreted as a lower triangular matrix
          If false, A is interpreted as a upper triangular matrix
  
      Returns
      -------
      :class:`.NDArrayNumericExpression`, (N,) or (N, K)
          Solution to the triangular system Ax = B. Shape is same as shape of B.
  
      """
      nd_dep_ndim_orig = b.ndim
      A, b = solve_helper(A, b, nd_dep_ndim_orig)
  
      indices, aggregations = unify_all(A, b)
  
      if no_crash:
          return_type = hl.tstruct(
              solution=hl.tndarray(hl.tfloat64, 2), failed=hl.tbool
          )
          ir = Apply(
              "linear_triangular_solve_no_crash",
              return_type,
              A._ir,
              b._ir,
              lower._ir,
          )
          result = construct_expr(
              ir, return_type, indices, aggregations
          )
          if nd_dep_ndim_orig == 1:
              result = result.annotate(
                  solution=result.solution.reshape((-1))
              )
          return result
  
      return_type = hl.tndarray(hl.tfloat64, 2)
      ir = Apply(
          "linear_triangular_solve",
          return_type,
          A._ir,
          b._ir,
          lower._ir,
      )
      result = construct_expr(ir, return_type, indices, aggregations)
      if nd_dep_ndim_orig == 1:
          result = result.reshape((-1))
      return result
  
imports: from functools import reduce
  import hail
  from hail.expr.functions import _ndarray
  from hail.expr.functions import array
  from hail.expr.types import HailType, tfloat64, tfloat32, ttuple, tndarray
  from hail.typecheck import typecheck, nullable, oneof, tupleof, sequenceof
  from hail.expr.expressions import expr_int32, expr_int64, expr_tuple, expr_any, expr_array, expr_ndarray, expr_numeric, Int64Expression, cast_expr, construct_expr, expr_bool, unify_all
  from hail.expr.expressions.typed_expressions import NDArrayNumericExpression
  from hail.ir import NDArrayQR, NDArrayInv, NDArrayConcat, NDArraySVD, NDArrayEigh, Apply
label_desc: Use image node_id 9 for calling a global function with example usage: solve_triangular(A, b, lower, no_crash) and returns: result, result