IntOrString for use in JSON/YAML

Specifying an API type as IntOrString will allow JSON and YAML to accept
either ints or strings with the same name.  For example, port names or
numbers.
panicing in the middle of a library is generally frowned upon. The function signature has an error return value; this would be a good place to use it.