Refactor the code for reading Calm records
Refactor the code for reading Calm records

This is likely to be useful in multiple places, so disentangle
it from the DynamoDB logic.  Also, two other big fixes:

* I have no idea how that ampersand regex ever worked without
  destroying the XML, because it would "fix" any ampersand that
  wasn't in '&amp;', i.e., other valid XML entities.
* The entity-corrected XML document is now cached between runs,
  because rebuilding it is time-consuming and in most cases
  completely unnecessary.

wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api