From http://stackoverflow.com/questions/522563/accessing-the-index-in-python-for-loops
index in loops