The common way of making win32 API calls in Python is through the pywin32 library:
If a particular call is missing (I think it is the case of SetwindowDisplayAffinity) then you can use ctypes from the standard library: https://docs.python.org/3/library/ctypes.html
@rob42 through the SetwindowDisplayAffinity call you should be able to create a region on screen which will appear black in screenshots. Certainly there are ways how to circumvent it: running the Windows OS in a VM, HDMI recorder, recording using a camera and probably many more.