A General Framework for the Derandomization of PAC-Bayesian Bounds