title: Python: check whether a network interface is up
body: <p>In Python, is there a way to detect whether a given <strong>network interface</strong> is <strong>up</strong>?</p>
  
  <p>In my script, the user specifies a network interface, but I would like to make sure that the interface is up and has been assigned an IP address, before doing anything else.</p>
  
  <p>I'm on <strong>Linux</strong> and I am <strong>root</strong>.</p>