memo-class python