How to write / read .xmp sidecar file?

Hi.
How to write / read .xmp sidecar file?
I need to write some information to read later by a lua script.