A general model for jet fragmentation