import pywikibot
from pywikibot import pagegenerators

#itemtitle = "Vienne"
itemtitle = "Top"
#itemtitle = "Debackere"


INSTANCE_OF_PROP = "P31"
FAMILY_NAME_PROP = "P734"
HUMAN_ITEM = "Q5"
FAMILY_NAME_ITEM = "Q101352"

site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()

sparql = "SELECT ?item WHERE { ?item rdfs:label 'Google'@en }"
entities = pagegenerators.WikidataSPARQLPageGenerator(sparql, site=repo)
entities = list(entities)
if len(entities) > 1:
    raise ValueError("Multiple family name instance with the same label")
elif len(entities) == 1:
    print(entities[0].getID())        
else:
    print("not found")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-18-402983263b22> in <module>()
     19 entities = list(entities)
     20 if len(entities) > 1:
---> 21     raise "Multiple family name instance with the same label"
     22 elif len(entities) == 1:
     23     print(entities[0].getID())

TypeError: exceptions must derive from BaseException