Section 6B. (a) As used in this section the following words shall, unless the context clearly requires otherwise, have the following meanings:—
''Dependent child'', a person under 18 years of age.
''Primary caretaker of a dependent child'', a parent with whom a child has a primary residence.
(b) Unless a sentence of incarceration is required by law, the court may, upon conviction, consider the defendant's status as a primary caretaker of a dependent child before imposing a sentence. A defendant may request such consideration, by motion supported by an affidavit, not more than 10 days after the entry of judgment. Upon receipt of such a motion supported by an affidavit, the court shall make written findings concerning the defendant's status as a primary caretaker of a dependent child and alternatives to incarceration. If such a motion has been filed, the court shall not impose a sentence of incarceration without first making such written findings.