This interface in the API can achieve this, but wont work in cpython3 as easily as in ironpython2.7 or C#: