A. A person who is not currently certified as acceptable to adopt but who has custody of a child who the person intends to adopt shall petition the court for an order permitting that person to keep custody of the child pending certification. The person shall file the petition not later than five days after the person obtains custody of the child. The court shall hold a hearing within ten days after the person files the petition. The child shall attend the hearing, except for good cause shown. At the hearing the burden of proof is on the petitioner to show that permitting custody is in the child’s best interests. The court may permit the petitioner to have custody or it may order that custody be given to some other person or agency as it deems to be in the child’s best interests. If the court permits the person to continue to have custody of the child, the court shall order the investigation for preadoption certification and report as required by section 8-105 to continue. If an application for certification has not been filed before the hearing, the court shall order that an application for certification be filed within thirty days after the hearing date.

B. If a petition is not filed by the person intending to adopt a child, the division, an agency or any other interested person may petition the court for such a hearing. On the filing of a petition the court shall set the matter for hearing and issue its order to the person having custody of the child to appear before it to show cause why custody should not be denied. The hearing shall then be held and the court’s order made as provided in subsection A of this section.

C. A custody petition or hearing is not required in any of the following cases:

1. If the person who intends to adopt the child is the spouse of a birth parent of the child.

2. If the person who intends to adopt the child or one of these persons is an uncle, aunt, adult sibling, grandparent, or great-grandparent of the child of the whole or half-blood or by marriage.

3. If the person who intends to adopt the child is currently certified as acceptable to adopt the child.

4. If custody of the child has been given or is to be given to an agency or to the division or to a licensed or certified foster home.

5. If the person who intends to adopt the child is currently the court appointed guardian of the child.