<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pdflookup(pdf, allresults, outformat, startpage=None):
 """Look a pdf up on google scholar and return bibtex items. Paramters --------- pdf : str path to the pdf file allresults : bool return all results or only the first (i.e. best one) outformat : int the output format of the citations startpage : int first page to start reading from Returns ------- List[str] the list with citations """

    txt = convert_pdf_to_txt(pdf, startpage)
    # remove all non alphanumeric characters
    txt = re.sub("\W", " ", txt)
    words = txt.strip().split()[:20]
    gsquery = " ".join(words)
    bibtexlist = query(gsquery, outformat, allresults)
    return bibtexlist