def parse_timestamp(timestamp):
    if '.' in timestamp:  # microseconds might not be pressent
        return datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%f').replace(tzinfo=timezone.utc)
    else:
        return datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S').replace(tzinfo=timezone.utc)
Parse a ISO 8601 timestamp string
dataset/ETHPy150Open jborg/attic/attic/helpers.py/parse_timestamp