title: How can a piece of python code tell if it's running under unittest
body: <p>I have a large project that is unit tested using the Python unittest module.</p>
  
  <p>I have one small method that controls large aspects of the system's behaviour. I need this method to return a fixed result when running under the UTs to give consistent test runs, but it would be expensive for me to mock this out for every single UT.</p>
  
  <p>Is there a way that I can make this single method, unittest aware, so that it can modify its behaviour when running under the unittest?</p>