The public defender

what is that? When am I entitled to a lawyer?