def iso8601(unixtime): if isinstance(unixtime, arrow.Arrow): return unixtime.isoformat().partition('.')[0] + 'Z' else: return datetime.datetime.utcfromtimestamp(unixtime - _UNIXTIME_OFFSET).isoformat() + 'Z'