def backsub_both_sides(L, X, transpose='<STR_LIT:left>'):
if transpose == '<STR_LIT:left>':<EOL><INDENT>tmp, _ = dtrtrs(L, X, lower=<NUM_LIT:1>, trans=<NUM_LIT:1>)<EOL>return dtrtrs(L, tmp.T, lower=<NUM_LIT:1>, trans=<NUM_LIT:1>)[<NUM_LIT:0>].T<EOL><DEDENT>else:<EOL><INDENT>tmp, _ = dtrtrs(L, X, lower=<NUM_LIT:1>, trans=<NUM_LIT:0>)<EOL>return dtrtrs(L, tmp.T, lower=<NUM_LIT:1>, trans=<NUM_LIT:0>)[<NUM_LIT:0>].T<EOL><DEDENT>
Return L^-T * X * L^-1, assumuing X is symmetrical and L is lower cholesky