PEP8 fixes; remove unneeded pyamg import; add `data` shape check