extract_index just iterates over the values and appends its elements to some list.  So isn't the list(...) call unnecessary?