def last_run(self):
        try:
            query = RunInfoHistory.objects.filter(subject=self)
            return query.order_by('-completed')[0]
        except IndexError:
            return None
Returns the last completed run or None
dataset/ETHPy150Open seantis/seantis-questionnaire/questionnaire/models.py/Subject.last_run