When trying to obtain the layer of an element fails, we try its parent.
fix get_structure_element_layer_id(). Add regression test.
Merge branch 'master' into windows-compat
use 'with' context in test_get_structure_elements_layer_id().