understand Producer and consumer problem with python