@classmethod
def last_trial(cls, script=None, parent_required=False, session=None):
    'Return last trial according to start time\n\n        Keyword arguments:\n        script -- specify the desired script (default=None)\n        parent_required -- valid only if script exists (default=False)\n        '
    model = cls.m
    session = (session or relational.session)
    trial = session.query(model).filter(model.start.in_(select([func.max(model.start)]).where((model.script == script)))).first()
    if (trial or parent_required):
        return trial
    return session.query(model).filter(model.start.in_(select([func.max(model.start)]))).first()
Return last trial according to start time

Keyword arguments:
script -- specify the desired script (default=None)
parent_required -- valid only if script exists (default=False)
@classmethod
def last_trial(cls, script=None, parent_required=False, session=None):
    'Return last trial according to start time\n\n        Keyword arguments:\n        script -- specify the desired script (default=None)\n        parent_required -- valid only if script exists (default=False)\n        '
    model = cls.m
    session = (session or relational.session)
    trial = session.query(model).filter(model.start.in_(select([func.max(model.start)]).where((model.script == script)))).first()
    if (trial or parent_required):
        return trial
    return session.query(model).filter(model.start.in_(select([func.max(model.start)]))).first()