Finite non-abelian 2-group has maximal class iff its abelianization has order four

Statement
Suppose $$P$$ is a non-abelian group of order $$2^n$$. Then, the following are equivalent for $$P$$:


 * $$P$$ is a fact about::maximal class group, i.e., its nilpotency class is $$n - 1$$.
 * The abelianization of $$P$$ has order four. Equivalently, the abelianization of $$P$$ is a Klein four-group. Equivalently, the commutator subgroup of $$P$$ has index four in $$P$$.

Related facts

 * Classification of finite 2-groups of maximal class