title: Make sure only a single instance of a program is running
body: <p>Is there a Pythonic way to have only one instance of a program running? </p>
  
  <p>The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this?  </p>
  
  <p>(Take into consideration that program is expected to fail sometimes, i.e. segfault - so things like "lock file" won't work)</p>