Quantum belief propagation: An algorithm for thermal quantum systems