Python String Index Substring Not Defined Meaning