请问复杂的字典转CSV如何实现啊?

if name == 'main':
assignment = {
'type': 'rectangle',
'properties': [{
'id': 1,
'name': '对象类型',
'items': ['小汽车', '大汽车', '人', '自行车'],
}, {
'id': 2,
'name': '是否清晰',
'items': ['是', '否'],
}, {
'id': 3,
'name': '是否完整',
'items': ['完整', '不完整'],
}],
}

annotations = [{
    'object_id': 100,
    'rectangle': {
        'x1': 100,
        'y1': 100,
        'x2': 150,
        'y2': 150,
    },
    'properties': [{
        'property_id': 1,
        'value': '自行车',
    }, {
        'property_id': 2,
        'value': '是',
    }, {
        'property_id': 3,
        'value': '完整',
    }]
}, {
    'object_id': 101,
    'rectangle': {
        'x1': 200,
        'y1': 100,
        'x2': 450,
        'y2': 150,
    },
    'properties': [{
        'property_id': 1,
        'value': '大汽车',
    }, {
        'property_id': 2,
        'value': '是',
    }, {
        'property_id': 3,
        'value': '不完整',
    }]
}, {
    'object_id': 102,
    'rectangle': {
        'x1': 100,
        'y1': 150,
        'x2': 120,
        'y2': 150,
    },
    'properties': [{
        'property_id': 3,
        'value': '完整',
    }, {
        'property_id': 1,
        'value': '大汽车',
    }, {
        'property_id': 2,
        'value': '否',
    }]
}, {
    'object_id': 103,
    'rectangle': {
        'x1': 300,
        'y1': 100,
        'x2': 400,
        'y2': 200,
    },
    'properties': [{
        'property_id': 3,
        'value': '完整',
    }, {
        'property_id': 1,
        'value': '人',
    }, {
        'property_id': 2,
        'value': '是',
    }]
}]

convert_to_csv(assignment, annotations)

要求用: csv.DictWriter.实现
格式类似于:

img