some python code for revenue management