clean up of is-instance and type and a code style refactor in pynn pop