def get_rfc3339(when):
    """Return an RFC 3339 timestamp.

    :param datetime.datetime when: a datetime in UTC
    :return: RFC 3339 timestamp
    :rtype: str
    """
    microseconds = format(when.microsecond, '04d')[:4]
    rfc3339 = '%Y-%m-%dT%H:%M:%S.{}Z'
    return when.strftime(rfc3339.format(microseconds))
