How to pass variable to mongo pipeline from python

My python code is as below:

pipeline= … “_id” : “$var_id”

collection.aggregate(pipeline)

Here, how to pass value for $var_id?

Pipeline query comes from mongo…it has got more stages… i want to pass value for 5 variables at different srages…

Please advise…