import time


def convert_epoch_ms_to_iso8601(record, timestamp_key):
    """ Convert epoch time ms to iso8601 format """
    s, ms = divmod(int(record[timestamp_key]), 1000)
    record[timestamp_key] = "%s.%03d" % (time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(s)), ms)
    return record