In general, I wouldn't make ANY of this type of assumption (even that particular fields exist; always do a data.get("last_attempt", "") (i.e with a default value), so that if it doesn't exist, there's no error).  For this, if the get is empty, I would return nothing for last_attempt.