'Generates a IDE number (9 digits).
http://www.bfs.admin.ch/bfs/portal/fr/index/themen/00/05/blank/03/02.html'

@classmethod
def ide(cls):

    def _checksum(digits):
        factors = (5, 4, 3, 2, 7, 6, 5, 4)
        sum = 0
        for i in range(len(digits)):
            sum += (digits[i] * factors[i])
        return (sum % 11)
    while True:
        digits = random.sample(range(10), 8)
        sum = _checksum(digits)
        control_number = (11 - sum)
        if (control_number != 10):
            digits.append(control_number)
            break
    digits = u''.join([str(digit) for digit in digits])
    return (((((u'CHE-' + digits[0:3]) + u'.') + digits[3:6]) + u'.') + digits[6:9])
