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