'Based on yaml.loader.BaseConstructor.construct_mapping.'

@classmethod
def construct_mapping(cls, loader, node, deep=False):

    if (not isinstance(node, yaml.MappingNode)):
        raise yaml.loader.ConstructorError(None, None, ('expected    a    mapping    node,    but    found    %s' % node.id), node.start_mark)
    mapping = OrderedYamlDict()
    for (key_node, value_node) in node.value:
        key = loader.construct_object(key_node, deep=deep)
        try:
            hash(key)
        except TypeError as exc:
            raise yaml.loader.ConstructorError('while    constructing    a    mapping', node.start_mark, ('found    unacceptable    key    (%s)' % exc), key_node.start_mark)
        value = loader.construct_object(value_node, deep=deep)
        mapping[key] = value
    return mapping
