Factor shopping.py into having a function