Share a document via Python

Is there a way to share a document through python?
I found frappe.share vaguely on the internet, but it is not documented whatsoever. I also can’t find a table where this gets stored or anything. Is it a type of metadata or something? I’m clueless.
Thanks for your help!

Have you tried using /api/method/frappe.share.add

Thanks for your help, but could you give me an example on how to call it inside of a whitelisted python method?

Hi, I was giving you an example.
You can import that function in your py file and call/use that function like usual.