Python code behind the boundaries blog post. See http://blog.thehumangeo.com/2014/05/12/drawing-boundaries-in-python/