How to change View3DShading type in 2.8?


I want to change the shading type to MATERIAL:
How can I do this with a script?

Edit: I figured it out:

for area in context.screen.areas:  # iterate through areas in current screen
    if area.type == 'VIEW_3D':
        for space in area.spaces:  # iterate through spaces in current VIEW_3D area
            if space.type == 'VIEW_3D':  # check if space is a 3D view
                space.shading.type = 'MATERIAL'  # set the viewport shading to material