TypeQL language library for Python will allow you to construct TypeQL queries programmatically, as opposed to manual string concatenations. For example, take the following native TypeQL query.
match $x isa person, has name "alice", has age 32;
The native TypeQL query above can be constructed programmatically in Python using this library, in the following way.
TypeQL.match(var("x").isa("person").has("name", "alice").has("age", 32));
This library is still under development by the community. You are welcome to contribute to this project development. You can learn more about TypeDB and TypeQL through vaticle/typedb and vaticle/typeql.