def matrix_identity(n: int) -> list:
    """
    Generate the n-sized identity matrix.
    """
    if n == 0:
        return [0]
    identity: list = []
    for col in range(n):
        column: list = []
        for row in range(n):
            if col == row:
                column.append(1)
            else:
                column.append(0)
        identity.append(column)
    return identity