As you know over Python 3.6, there is a feature known as format string literals. str(obj['my_str_index']) can be either None or a string value. I've tried the below one but it doesn't yield 'null' text if it is None.
foo = "soner test " \
f"{str(obj['my_str_index']) if str(obj['my_str_index']) is not None else 'null'}