def next_id(prev_id):
    """Generate next lexical id.

    Increments by one and adds padding if required.

    >>> next_id("0098")
    '0099'
    >>> next_id("0099")
    '0100'
    >>> next_id("0999")
    '11000'
    >>> next_id("11000")
    '11001'
    """
    num_digits = len(prev_id)
    if prev_id.count('9') == num_digits:
        raise OverflowError('max lexical version reached: ' + prev_id)
    _prev_id_val = int(prev_id, 10)
    _maybe_next_id_val = int(_prev_id_val) + 1
    _maybe_next_id_str = '{0:0{1}}'.format(_maybe_next_id_val, num_digits)
    _is_padding_ok = prev_id[0] == _maybe_next_id_str[0]
    _next_id_str = None
    if _is_padding_ok:
        _next_id_str = _maybe_next_id_str
    else:
        _next_id_str = str(_maybe_next_id_val * 11)
    return _next_id_str
