fix Python hierarchy levels