I have two csv files  

file1.csv:

```
ID,map1,map2  
a,x1,x2  
b,y1,  
c,z1,z2  

```

file2.csv: 

```
ID,map1Val1,map1Val2,map2Val1
a,a1,a2,l1
b,b1,b2,
c,c1,c2,n1

```

I want the output to look like: 

```
{'ID': {'map1':['map1Val1','map1Val2'], 'map2':'map2Val1'},'a': {'x1':['a1','a2'], 'x2':'l1'},'b': {'y1':['b1','b2']},'c': {'z1':['c1','c2'], 'z2':'n1'},}  

```

The I can't think of any way to create this. So far i have just a code to create a dictionary from one csv file: 

```
import csv
new_data_dict = {}
with open("file1.csv", 'r') as map_file:
    mapping = csv.DictReader(map_file, delimiter=",")
    for row in mapping:
        new_data_dict= {row[0]:{row[1],row[2]}}
print new_data_dict

```

Output: 

```
{"ID":{map1,map2}, "a":{x1,x2}, "b":{y1}, "a":{z1,z2}}

```