<p>I'm trying to decode the result of the Python os.wait() function. This returns, according to the Python docs:</p>

<blockquote>
  <p>a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced.</p>
</blockquote>

<p>How do I decode the exit status indication (which is an integer) to obtain the high and low byte? To be specific, how do I implement the decode function used in the following code snippet:</p>

<pre><code>(pid,status) = os.wait()
(exitstatus, signum) = decode(status) 
</code></pre>

This will do what you want:
```
```
signum = status & 0xff
exitstatus = (status & 0xff00) >> 8
```
```