warning: assigned but unused variable - patch
warning: mismatched indentations at 'end' with 'def' at 11
warning: shadowing outer local variable - last_index
warning: assigned but unused variable - position
warning: assigned but unused variable - e
warning: shadowing outer local variable - index