Control flow of for loops
<p>I am writing a pseudo code where I want the below two "for" loops to be repeated until all the keys in data_changes and modem_changes are same, i.e. there should not be any keys that are present data_changes but not in modem_changes and vice versa.  I should be able to write the Python implementation after this; can anyone provide inputs?
EDITED:</p>

<p>am more interested in </p>

<ol>
<li>how to call func1 and func2 for keys that are present in one and not the other</li>
</ol>

<p>2.repeating the for loops until the keys are the same in data_changes and modem_changes</p>

<pre><code>data_changes = {
    '253036': [''], 
    '313115': ['313113']
    }

modem_changes = {'305403': [], 
                 '311957': ['253036', '312591']
                 }

s1 = set(data_changes.keys())
s2 = set(modem_changes.keys())
value1 = s2.difference(s1)
print value1
value2 = s1.difference(s2)
print value2

def func1 (data_changes,key):
    if key == '311957':
        output = ''
    if key == '305403':
        output = ''
        return output

def func2 (modem_changes,key):
    if key == '313115':
        output =''
    if key == '253036':
        output=''
    return output

def method(d1, f1, d2, f2):
    s1 = set(d1.keys())
    s2 = set(d2.keys())
    for k in s2.difference(s1):#set(['311957', '305403'])
        f1(d1, k) # k in d2 not in d1.
    for k in s1.difference(s2):#set(['313115', '253036'])
        f2(d2, k) # k in d1 not in d2.

while(True):
    method(data_changes, func1, modem_changes, func2)
    value = set(data_changes.keys()) - set(modem_changes.keys()) 
    print value
    if value == set([]):
        break;


EXPECTED OUTPUT:-

data_changes = {
    '253036': [''], 
    '313115': ['313113']
    '305403':[''] 
    '311957':['']
    }

modem_changes = {'305403': [], 
                 '311957': ['253036', '312591']
                 '253036':[]
                 '313115':[] 
                 }
</code></pre>
