def METHOD_NAME(rpm_publication_api, gen_object_with_cleanup):
    """A factory to generate an RPM Publication with auto-deletion after the test run."""
    def _rpm_publication_factory(pulp_domain=None, **body):
        # XOR check on repository and repository_version
        assert bool("repository" in body) ^ bool("repository_version" in body)
        kwargs = {}
        if pulp_domain:
            kwargs["pulp_domain"] = pulp_domain
        return gen_object_with_cleanup(rpm_publication_api, body, **kwargs)
    return _rpm_publication_factory