The PyHST2 hybrid distributed code for high speed tomographic reconstruction with iterative reconstruction and a priori knowledge capabilities. We present the PyHST2 code which is in service at ESRF for phase-contrast and absorption tomography. This code has been engineered to sustain the high data flow typical of the 3rd generation synchrotron facilities (10 terabytes per experiment) by adopting a distributed and pipelined architecture. The code implements, beside a default filtered backprojection reconstruction, iterative reconstruction techniques with a priori knowledge. These latter are used to improve the reconstruction quality or in order to reduce the required data volume or the deposited dose to the sample and reach a given quality goal. The implemented a priori knowledge techniques are based on the total variation penalization and a new recently found convex functional which is based on overlapping patches. We give details of the different methods and discuss how they are implemented in the PyHST2 code, which is distributed under free license. We provide methods for estimating, in the absence of ground-truth data, the optimal parameters values for a priori techniques.