pyruntime: Simplify and unify port calls