Sec. 11. In a proceeding under Section 2, 3, or 4 or Subsection (b) of Section 5 of this article, if the defendant is not represented by counsel and the court finds that the defendant is not able to obtain counsel for the purposes of the proceeding, the court shall appoint counsel to represent the defendant at the proceeding.