def METHOD_NAME(self, timestamp_str):
    now = datetime.datetime.utcnow()
    try:
        timestamp = datetime.datetime.strptime(
            timestamp_str, "%Y-%m-%dT%H:%M:%S.%fZ"
        )
    except ValueError:
        raise InvalidMessageError("Unknown Timestamp format")
    age = now - timestamp
    if age > datetime.timedelta(hours=1):
        raise InvalidMessageError("Message has expired")