python: Do not depend on access to internal data structures.