Update reference.py

fixed an error in raising an error :)