Adding a python list parameter in a neo4j query

  cypher, neo4j, py2neo, python

I’m about to run a query in neo4j with a parameter, but it always returns me an error.

> query= ("MATCH (p1:Item),(p2:Item) where p1.value=$name
> RETURN  p1.value AS from, p2.value AS to,
> gds.alpha.similarity.euclideanDistance((p1.embeddingNode2vec),
> (p2.embeddingNode2vec)) AS similarity order by similarity desc limit
> 40", name=references[2])

the p1.value the first element in the references list. This returns me a

SyntaxError: invalid syntax

error. Could you please tell me how to run it?
my research so far:

Source: Python Questions