import requests


def get_qid_for_title(title):
    """
    Gets the best Wikidata candidate from the title of the paper. 
    """
    api_call = f"https://www.wikidata.org/w/api.php?action=wbsearchentities&search={title}&language=en&format=json"
    api_result = requests.get(api_call).json()
    if api_result["success"] == 1:
        return(api_result["search"][0]["id"])