from datetime import datetime
import pytz


def iso8601_from_usec(usec):
    """Return a microsecond timestamp as an ISO8601 string

    Note that we prefer the UTC format using 'Z' defined by W3 over the
    equally valid +00:00 used by default in Python.
    """
    return datetime.fromtimestamp(usec / 1e6, pytz.utc).isoformat()[:-6] + 'Z'