A Theoretical Framework for Inference and Learning in Predictive Coding Networks Code accompanying the paper