If the ``job_id`` provided is invalid ``log`` will be an empty list. Retrieving a specific index from an empty list in python will generate an ``IndexError``. A safer way of handling this would be to use ``len()``. So something like:

```
if len(log) > 0:
   ...do stuff...
```