Language attribute: accessibility requirements

I need to add a language attribute (i.e., lang="en-US").
I have defined the language attribute as such in html.Div attributes but when I use an accessibility checker (Siteimprove) it indicates that “language of page has not been set”.

It should look something like this
<!DOCTYPE html>
<html lang=“en-US”>`


Solved it with app.index

app.index_string = '''
<!DOCTYPE html>
<html xmlns='' xml:lang='en' lang='en'>

Can someone explain to me how this works? Is the structure of head/body and the subitems config/scripts etc. always the same? I just copied the solutionfrom @reirei and it works for me. However, I would like to understand it better.