Add helpers for parsing port range strings.

We'll be using this in the GCE provider.

(Review request: http://reviews.vapour.ws/r/612/)