Two helper methods

These two helper methods are in some other open source libraries but we don't always include those. It bugged me enough that I added them here.

Signed-off-by: Aaron Rosenzweig <aaron@chatnbike.com>