Actually, I'd have thought that you'd want to get rid of Line 75 instead - that way you will return an empty list if site_map is empty.