Converted tabs to spaces, changed TypeError to ValueError