code: def prop2qid(prop, value, endpoint='https://query.wikidata.org/sparql'):
      
      arguments = '?item wdt:{} "{}"'.format(prop, value)
      query = 'SELECT * WHERE {{{}}}'.format(arguments)
      results = wdi_core.WDItemEngine.execute_sparql_query(query, endpoint=endpoint)
      result = results['results']['bindings']
      if len(result) == 0:
          # not found
          return None
      elif len(result) > 1:
          raise ValueError("More than one wikidata ID found for {} {}: {}".format(prop, value, result))
      else:
          return result[0]['item']['value'].split("/")[-1]
docs: Lookup a wikidata item ID from a property and string value. For example, get the item QID for the
       item with the entrez gene id (P351): "899959"
      >>> prop2qid('P351','899959')
      :param prop: property
      :type prop: str
      :param value: value of property
      :type value: str
      :return: wdid as string or None