Set (very) specific OpenSSL options

How can I reach OpenSSL internals in Python? I would like to specify key exchange algorithms through OpenSSL’s groups. This is achiavable in OpenSSL’s s_client tool, for instance.

Perhaps this could be done if there is a way of reaching OpenSSL’s config_ctx through CPython’s wrapper of SSL.

Can I possibly reach this option of OpenSSL through Python? Is this possible? In the worst case, can I do it in CPython? I don’t have any experience with CPython, so I would like to avoid that route instead.

Thank you.

For anyone interested, this is the best solution I have found so far