A versatile and comprehensive analysis code for automated reduction of gamma-ray spectral data