db/models:

Added a `as_string_io` property shortcut to ModelContent.
input/logictree:

Refactored some parts to use a slightly more DRY way of referring
to model content, with StringIO objects, etc.
calcs:

Refactored parts of code that were referring to the raw model content
and made them a bit more DRY.
tests/input/logictree_test:

All tests pass.