Horrible Python code I have written