I suspect there's a more pythonic way of doing this with string formatting, but it is quite sound as is