title: Overriding/Patching function from third-party module
body: <p>I am looking for the best practice way to overwrite/patch a function that is being imported from a third-party module.  For example, in my code i am importing and using the function like so:</p>
  
  <pre><code>from somemodule import some_function
  foo = 3
  bar = 5
  some_function(foo, bar)
  </code></pre>
  
  <p>I would now like to override some_function with my own function. Im my own function, i want to do some magic and then call the orignal function.</p>
  
  <p>Right now, i am doing this like so:</p>
  
  <pre><code>from somemodule import some_function as some_function_original
  
  def some_function(f, b):
      # do some magic
      return some_function_original(f, b)
  
  foo = 3
  bar = 5
  some_function(foo, bar)
  </code></pre>
  
  <p>However, i would like to avoid the "from [..] import [..] as [..]" and keep the original function name and just overrite/patch it?</p>