I need to apply some formula on existing dict and generate a new dict with new keys and calculated values in it.

Consider the dict which is as follows:

```
samples_dict = {'sample1': {u'Bhubaneswar': 21.0, u'Mumbai': 63.0},
               'sample2': {u'Bhubaneswar': 600.67, u'Mumbai': 1000.01},
               'sample3': {u'Bhubaneswar': 700.0, u'Mumbai': 2100.0},
               'sample4': {u'Bhubaneswar': 625.94, u'Mumbai': 1877.82},
           'sample5': {u'Bhubaneswar': 425.94, u'Mumbai': 877.82}}

```

Here I need to apply formula as follows:

```
formula = sample1+sample2

```

I am creating a list with keys which I need to be check for in dict using the formula. Also will create a new dict now.

```
sample_list = re.findall("\w+,*", formula)

new_dict = {sample: samples_dict[sample] for sample in sample_list if sample in samples_dict}

```

new\_dict I created now is as follows now:

```
{'sample1': {u'Mumbai': 63.0, u'Bhubaneswar': 21.0}, 'sample2': {u'Mumbai': 1000.01, u'Bhubaneswar': 600.67}}

```

Now here I need to apply this formula in to this dict for creating a new item using the formula given.

Finally I need to merge with the base dict and I need the result now as follows:

I hope can use eval, someone help me how to do so.

```
samples_dict = {'sample1': {u'Bhubaneswar': 21.0, u'Mumbai': 63.0},
               'sample2': {u'Bhubaneswar': 600.67, u'Mumbai': 1000.01},
               'sample3': {u'Bhubaneswar': 700.0, u'Mumbai': 2100.0},
               'sample4': {u'Bhubaneswar': 625.94, u'Mumbai': 1877.82},
           'sample5': {u'Bhubaneswar': 425.94, u'Mumbai': 877.82},
           'sample6': {u'Bhubaneswar': 621.67, u'Mumbai': 1063.01}}

```

Some one help me with the same.