def dict_subset(d, fields):
    return {k: d[k] for k in d if ((k in fields) and (d[k] is not None))}
def dict_subset(d, fields):
    return {k: d[k] for k in d if ((k in fields) and (d[k] is not None))}