import colander def none_to_null(d): r = dict() for key in d: val = d[key] if val is None: val = colander.null r[key] = val return r