A related problem also hard to solve, how to find a job as a software engineer for a pleasant highly functional sane company. Let me know if there is a solution.
Most likely this will be anything but pleasant, but if you are very careful about not accepting VC financing you may try to optimize for sanity... highly functional will come mostly as you learn from your own errors.
One question that I think correlates low with a highly functional sane tech company is "Does your CEO still write code for the product?" if the answer is yes and the company is larger than 20 people, odds are high that the company/CEO is not highly functional.
You know what to do when each of the 3 interviewers of your on-site give a blank stare to this question :D