In general, you might wanna consider using the plumbum like @russellhaering did here: https://github.com/rackerlabs/teeth-agent/blob/master/teeth_agent/hardware.py#L128