I didn't actually write this function.  It was already part of goes.py.  I did make a couple changes to bring it in line with PEP8.