def as_data(self):
    data = {}
    for (k, v) in self.contents.items():
        set_if_not_none(data, to_data(list_is_optional(v)), k)
    return data
def as_data(self):
    data = {}
    for (k, v) in self.contents.items():
        set_if_not_none(data, to_data(list_is_optional(v)), k)
    return data