Implementation of the problem about producers and consumers(based python)