def _find_run_id(traces, item_id):
    """Find newest run_id for an automation."""
    for trace in reversed(traces):
        if trace["item_id"] == item_id:
            return trace["run_id"]

    return None