def _date_in_range(date, date_range):
    """Check that a date is inside a range. If range is None, return True."""
    if date_range == None:
        return True
    if date_range[0] and date < date_range[0]:
        return False
    if date_range[1] and date > date_range[1]:
        return False
    return True
