def _date_range(data):
    """Return the first and last dates in data"""
    try:
        first = data[0]["date"]
        last = data[0]["date"]
    except KeyError:
        # /recent has no dates
        return None, None
    for row in data:
        date = row["date"]
        if date < first:
            first = date
        elif date > last:
            last = date

    return first, last