How does ExtractOption and FillGap work?

Hi all,

I am trying to see if I can use the FillGap property of ExtractOptions to close a series of lines or polylines automatically for me. However I am not sure how this actually works. I am trying to use a Python node to get it to take an open polyline and close it within the specfied FillGap of say 1m.
Does anyone know how this works, or how we can work this into a script so it will take the selected open polyline, close it and output that new geometry for further work?
Unfortunately i couldnt find far too much guidance on it other than from the reference guide.

Links to the CAD API guide here:
https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_Runtime_ExtractOption
https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_Runtime_ExtractOption_FillGap