def formatdt(date, include_time=True):
    """Formats a date to ISO-8601 basic format, to minute accuracy with no
    timezone (or, if include_time is False, omit the time)."""
    if include_time:
        return date.strftime("%Y-%m-%dT%H:%M")
    else:
        return date.strftime("%Y-%m-%d")