You should use OrderCancel() for the operand in question. This is how Juergen's suggestion of instantiating an object is translated to Python.
?
Seeing that you are highly dependent on the documentation you might consider installing the "stable" client API 10.19 which I believe most of docs are centered around.
?
Also while this group is dedicated mostly to the original IBKR's client API, when it comes to Python the excellent independent alternative ib_async package is arguably much easier to use. But even then limitations of a naive copy-and-paste approach without learning key concepts and practices of the underlying programming language will betray themselves pretty soon. (Note that beside Python, the original client API is also available in C, C# and Java, so there's plenty of choices that could be more suitable to your experience).
?
--
Best,
DS