def id_num_digits(parts):
    """Returns the tuple (label, number of digits) for the ID box.

       Receives the splitted text of the template for the exam, which
       may contain a key like 'id-box(9,NIA)' in an odd position, in
       which NIA is the label and 9 the number of digits. If the key
       does not exist in the template, returns (0, None).

    """
    for part in parts[1::2]:
        if part.startswith('id-box'):
            data = part[7:-1].split(',')
            return data[1], int(data[0])
    return None, 0
