how can I replace the value with the key in dictionary in python? : <p>I want the function inverse to return this output:</p>

<pre><code>{3: ['I', 'love'], 2: ['python']}
</code></pre>

<p>the function will replace the key and the value, but if there's the same value twice, it'll be one key. how can I do that?
// here's the code:</p>

<pre><code>def inverse(dict1):

   def main():
        dict1 = {'I': 3, 'love': 3, 'python': 2}
        print(inverse(dict1))

    if __name__ == "__main__": 
        main()
</code></pre>
