title: Get opposite of function in Python
body: <p>Assuming the function:</p>
  <pre><code>def my_function(a):
      return 2 * a
  </code></pre>
  <p>Is there a Pythonic way to obtain the function that would otherwise be defined as:</p>
  <pre><code>def my_opposite_function(a):
      return a / 2
  </code></pre>
  <p>with a syntax such as:</p>
  <pre><code>my_opposite_function = something(my_function)
  </code></pre>