Application of the Keldysh Formalism to Quantum Device Modeling and Analysis