+
+
+def _make_replication_server(url: str) -> ContextManager[ReplicationServer]:
+ """ Returns a ReplicationServer in form of a context manager.
+
+ Creates a light wrapper around older versions of pyosmium that did
+ not support the context manager interface.
+ """
+ if hasattr(ReplicationServer, '__enter__'):
+ return cast(ContextManager[ReplicationServer], ReplicationServer(url))
+
+ @contextmanager
+ def get_cm() -> Generator[ReplicationServer, None, None]:
+ yield ReplicationServer(url)
+
+ return get_cm()