This library can generate railML 3.1 files from a yaramo topology.
To use the exporter as a library, install it via:
pip3 install git+https://github.com/simulate-digital-rail/railml-exporter
Afterwards you can import it to your application with:
from railml_exporter.exporter import Exporter
# topology is a yaramo.models.Topology object
exporter = Exporter(topology)
xml_string = exporter.to_string()
exporter.to_file('path/to/file.xml')
Further examples can be found in the demo repository.