Ruby's as_json in Python
class Document():
def as_dict(self, without=[]):
res = {}
for prop in vars(self):
if prop in without:
continue
res[prop] = getattr(self, prop)
return res
You could also simply implement and use dict, if without is not needed.