def METHOD_NAME(loader, node, deep=False):
    """Check for duplicate keys."""
    mapping = {}
    errors = []
    for key_node, value_node in node.value:
        key = loader.construct_object(key_node, deep=deep)
        value = loader.construct_object(value_node, deep=deep)
        if key in mapping:
            errors.append([key, key_node.start_mark.line])
        mapping[key] = value
    if len(errors) > 0:
        raise Exception(errors)
    return loader.construct_mapping(node, deep)