Escaping is automatic, you just have to call:
cursor.execute("query with params %s %s", ("param1", "pa'ram2"))
(notice that the python % operator is not used) and the values will be correctly escaped.
You can escape manually a variable using extensions.adapt(var)
, but this would be error prone and not keep into account the connection encoding: it is not supposed to be used in regular client code.