There is no pre-existing python code to do that, as that is done in the viewer, in javascript via cfi.pyj. You would need to write that yourself.
First you get a container object from the path to the epub then you get the individual file using spine_index. Get the root of it using Container.parsed(). Then translate the cfi to a node, which should be pretty easy, if you ignore the text part of it and just stop at the containing node.
|