  Here we present the derivation, description and results of a Monte
Carlo-based algorithm for simulating inelastic scattering of photo-electrons
when passing through some scattering medium, such as a gas atmosphere or a
solid material. The code used to run these simulations was written in python
and is freely available online
(https://github.com/surfaceanalytics/montecarlo_electron_scattering).
