Is there something wrong with this code i wrote? i get the feeling i made a mistake and cant quite recall what, its quite frustrating.

The function is supposed to determine the dimensions of a matrix and if it is, or is not, a valid matrix ( for example, if a row in the matrix isn't equal to another, and such)

```
def matrixDimensions(m):
z = []
ms = len(str(m).split('[')) - 2
for x in range(ms):
z.append(len(m[x]))
if z[0] == z[1]:
return "This is a %dx%d matrix." % ((len(z)),z[0])
else:
return "This is not a valid matrix."
```

im sure i spotted an error but i cant recall it. It works when i tested it but i think there is an error the tests i used wouldn't catch.

Please help, would me much appreciated.