This function really deserves a testcase. Also I'd prefer name which which would indicate what is it about, prettyPrint is quite generic...