'This method is called to validate the digits of the 9-digit number
found, to confirm that it is a valid SSN. All the publicly available SSN
checks are performed. The number is an SSN if:
1. the first three digits <= 772
2. the number does not have all zeros in any digit group 3+2+4 i.e. 000-xx-####,
###-00-#### or ###-xx-0000 are not allowed
3. the number does not start from 666-xx-####. 666 for area code is not allowed
4. the number is not between 987-65-4320 to 987-65-4329. These are reserved for advts
5. the number is not equal to 078-05-1120
Source of information: wikipedia and socialsecurity.gov'

def _validate_SSN(self, potential_ssn):

    try:
        area_number = int(potential_ssn.group(2))
        group_number = int(potential_ssn.group(4))
        serial_number = int(potential_ssn.group(5))
    except:
        return False
    if (not group_number):
        return False
    if (not serial_number):
        return False
    group = areas_groups_map.get(area_number)
    if (not group):
        return False
    odd_one = xrange(1, 11, 2)
    even_two = xrange(10, 100, 2)
    even_three = xrange(2, 10, 2)
    odd_four = xrange(11, 100, 2)
    le_group = (lambda x: (x <= group))
    isSSN = False
    if (group in odd_one):
        if (group_number <= group):
            isSSN = True
    elif (group in even_two):
        if (group_number in itertools.chain(odd_one, filter(le_group, even_two))):
            isSSN = True
    elif (group in even_three):
        if (group_number in itertools.chain(odd_one, even_two, filter(le_group, even_three))):
            isSSN = True
    elif (group in odd_four):
        if (group_number in itertools.chain(odd_one, even_two, even_three, filter(le_group, odd_four))):
            isSSN = True
    if isSSN:
        return ('%s-%s-%s' % (area_number, group_number, serial_number))
    return None
