'CIF validation'

def clean(self, value):

    value = super(ROCIFField, self).clean(value)
    if (value in EMPTY_VALUES):
        return u''
    if (value[0:2] == 'RO'):
        value = value[2:]
    key = '753217532'[::(-1)]
    value = value[::(-1)]
    key_iter = iter(key)
    checksum = 0
    for digit in value[1:]:
        checksum += (int(digit) * int(key_iter.next()))
    checksum = ((checksum * 10) % 11)
    if (checksum == 10):
        checksum = 0
    if (checksum != int(value[0])):
        raise ValidationError(self.error_messages['invalid'])
    return value[::(-1)]
