splitting Python example with error codes from the basic Python example