Convert a for in loop to a plain for loop