The snake was captured to be sold on the black market for sapphires, but it escaped the first basket which is why it looks as it does. Once freed, the snake worked up an appetite and smelled the goodies in the center basket and went out to lunch. After that it was tired and wanted a nap, and certainly the snake wouldn't want to sleep in the mess it made in the goodies basket. So the snake thought it prudent to go into the rightmost basket to nap before its trip back to its river den.