Useful pieces of python code I have come across in readings