A Practical Framework for Quantum Error Mitigation