How to pass variable to mongo pipeline from python

This works only if i pass mongo query directly to aggregate…

Whereas my requirement is i am fetching query from mongo…and it is string…when i pass string to aggregate it throws error as aggregate accept only list…so i am using json.loads. and it expects double quotes for variable…

So how to pass variable from python to mongo pipeline…
My pipeline varrable has big mongo query with many parameters to be psses

pipeline= ($match: var_id), ($match: date: todasdate)
collection.aggregate(pipeline)