Keyerror Not In Index Python Function Questions