Add Encode helper

Replacement for https://github.com/interagent/pliny-template/pull/126

Pull Request for template: https://github.com/interagent/pliny-template/pull/132
Cosmetics, but how do you folks feel about the coding style here? I normally don't align params in the second line like this, but down for a change if there's precedence/etc.