def column_lettering(colnum: int) -> str:
    """
    Converts a zero-based column index into a spreadsheet-style column name
    (A[0] to Z[25], then AA[26] to AZ[51], etc). Basically, it's almost base
    26, but without a proper sense of zero (in that A is zero, but AA is 26).
    """
    assert colnum >= 0
    base = 26
    zero_char = ord("A")
    reversed_chars = ""
    while True:
        big, small = divmod(colnum, base)
        reversed_chars += chr(zero_char + small)
        if big == 0:
            break
        colnum = big - 1
    return reversed_chars[::-1]