Pretty good discussion
here on parsing/serializing the metadata fragment as pure xml with sigil_bs4.Beautiful soup.
And as mentioned in that discussion, /src/Resource_Files/python3lib/xmlprocessor.py in the Sigil source code (or Program Files\python3lib\xmlprocessor.py in a Windows Sigil installation) has examples on how to parse pure xml with bs4.