Number of unique distances should be 2. (4 for sides, and 2 for diagonals)

```
class Solution(object):
def validSquare(self, p1, p2, p3, p4):
points = [p1, p2, p3, p4]
dists = collections.Counter()
for i in range(len(points)):
for j in range(i+1, len(points)):
dists[self.getDistance(points[i], points[j])] += 1
return len(dists.values())==2 and 4 in dists.values() and 2 in dists.values()
def getDistance(self, p1, p2):
return (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2
```