def _processResults(select, arr, allVars):
    retval = []

    if not select: select=allVars
            
    for bind in arr:
        # each result binding must be taken separately
        qresult = []

        for s in select:
            qresult.append(bind.get(s))

        # as a courtesy to the user, if the selection has one single
        # element only, then we do not put in a tuple, just add it
        # that way:
        if len(select) == 1:
            retval.append(qresult[0])
        else:
            retval.append(tuple(qresult))

    return retval
The result in an expansion node is in the form of an array of
dataset/ETHPy150Open RDFLib/rdfextras/rdfextras/sparql/query.py/_processResults