def date_to_iso8601(date):
    """Returns an ISO8601 string from a date"""
    datetimestr = date.strftime('%Y-%m-%dT%H:%M:%S')
    timezone_sign = date.strftime('%z')[0:1]
    timezone_str = '%s:%s' % (date.strftime('%z')[1:3], date.strftime('%z')
        [3:5])
    return '{datetimestr}{tzsign}{timezone}'.format(datetimestr=datetimestr,
        tzsign=timezone_sign, timezone=timezone_str).replace(':', '%3A'
        ).replace('+', '%2B')
