':type version1: str
:type version2: str
:rtype: int'

def compareVersion2(self, version1, version2):

    v1 = [int(x) for x in version1.split('.')]
    v2 = [int(x) for x in version2.split('.')]
    while (len(v1) != len(v2)):
        if (len(v1) > len(v2)):
            v2.append(0)
        else:
            v1.append(0)
    return cmp(v1, v2)
