Writting Efficient Python Code