def fromexportreg(cls, bundle, export_reg):
        # type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent
        """
        Creates a RemoteServiceAdminEvent object from an ExportRegistration
        """
        exc = export_reg.get_exception()
        if exc:
            return RemoteServiceAdminEvent(
                RemoteServiceAdminEvent.EXPORT_ERROR,
                bundle,
                export_reg.get_export_container_id(),
                export_reg.get_remoteservice_id(),
                None,
                None,
                exc,
                export_reg.get_description(),
            )

        return RemoteServiceAdminEvent(
            RemoteServiceAdminEvent.EXPORT_REGISTRATION,
            bundle,
            export_reg.get_export_container_id(),
            export_reg.get_remoteservice_id(),
            None,
            export_reg.get_export_reference(),
            None,
            export_reg.get_description(),
        )