<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def max_id_length(p_num):
 """ Returns the length of the IDs used, given the number of items that are assigned an ID. Used for padding in lists. """

    try:
        alphabet = config().identifier_alphabet()
        length, _ = _get_table_size(alphabet, p_num)
    except _TableSizeException:
        length, _ = _get_table_size(_DEFAULT_ALPHABET, p_num)

    return length