'When leaving scope, makes sure new object is initialized.
This method is mainly for picking up on any missing required attributes.
Args:
top_value: Parent of closing mapping object.
mapping: _ObjectMapper instance that is leaving scope.'

def EndMapping(self, top_value, mapping):

    if (not hasattr(mapping.value, 'CheckInitialized')):
        raise validation.ValidationError('Cannot    convert    map    to    non-map    value.')
    try:
        mapping.value.CheckInitialized()
    except validation.ValidationError:
        raise
    except Exception as e:
        try:
            error_str = str(e)
        except Exception:
            error_str = '<unknown>'
        raise validation.ValidationError(error_str, e)
