Any provisions of this Code with respect to exemption, justification or extenuation in relation to an act shall apply with necessary modifications to an attempt to commit an act.