resource['contents'][media_type] = []
for index in (0, 2):
    item = row[i]
if item is not None:
    resource['contents'][media_type].append(item.toPython())
Is this a valid use of a conditional expression?