For the purpose of determining the grade and classification of an offense under sections 18-8-201, 18-8-206, and 18-8-208, a person in custody or confinement for an offense which is unclassified or was not classified under this code at the time the custody or confinement began is deemed to have been in custody or confinement for a class 2 misdemeanor if such custody or confinement was for a misdemeanor offense or a class 5 felony if such custody or confinement was for a felony offense.