model.Session.query(model.Resource.resource_group_id, func.max(model.
    Resource.last_modified)).group_by(model.Resource.resource_group_id
    ).order_by(func.max(model.Resource.last_modified).desc())
SqlAlchemy select with max, group_by and order_by