(a) A person, either before trial or after conviction, who is detained under this chapter may be released temporarily if
- (1) the person is being held in connection with a misdemeanor or class B or C felony;
(2) the release is requested because of the
- (A) death of an immediate family member of the person;
- (B) birth of the person's child if the defendant executes an affidavit of paternity before the release;
- (C) person's need for a mental health or substance abuse assessment that the court finds cannot be accommodated in the facility or telephonically; or
- (D) person's need for a medical or dental examination required for acceptance into a residential treatment facility; and
- (3) the court solicits information from the Department of Corrections regarding the defendant's conduct while incarcerated and considers that information when making a decision under this subsection.