import pytz


def utcisoformat(dt):
    """Return a datetime object in ISO 8601 format in UTC, without microseconds
    or time zone offset other than 'Z', e.g. '2011-06-28T00:00:00Z'.

    Useful for making Django DateTimeField values compatible with the
    jquery.localtime plugin.
    """
    TZ = pytz.timezone("Europe/Paris")
    return (
        TZ.localize(dt.replace(microsecond=0))
        .astimezone(pytz.utc)
        .replace(tzinfo=None)
        .isoformat()
        + "Z"
    )