title: Find out if a python script is running in IDLE or terminal/command prompt
body: <p>Is there a way to find out if the python script is running in the IDLE interpreter or the terminal?</p>
  
  <p>Works cross-platform if possible, or if needed a different way for each platform.</p>
  
  <p>Work with Python 2 and Python 3 if possible, or if needed a different way for each version.</p>
  
  <p>The only way I could think of is checking the processes running for IDLE but I don't know how to do that right.</p>
  
  <p>If IDLE is open for another script and my script is running in the terminal, a process check would return true even if my script is not running in the IDLE.</p>
  
  <p>My script needs to run differently depending on if it is running in IDLE or a terminal.</p>