generate_packets.py: unify format of generated code strings
As a side effect (or rather, the conscious decision to not always avoid those side effects), this patch also gets rid of a significant number of unnecessary/"erroneous" blank lines introduced by unescaped line breaks at the beginning of certain multiline strings (that didn't fit the surrounding pattern ~> likely weren't intended).
Part of #43927. Make all strings representing generated code have the same general shape so they can all be worked with the same way.
The style that seemed to work well when prototyping is as follows:
Functionally, strings that represent zero or more entire lines of code should
or, equivalently
Stylistically, strings that represent one or more entire lines of code should
The empty string should be written as "" (using double quotes, not single quotes).
Functionally, strings that represent an expression that is not an entire line should
Stylistically, strings that represent an expression should
Example:
Note: All code being written as un-indented as possible (as in this example) is covered by #44977.