'Return a dictionary with model\'s attributes.'

def to_dict(self):

    d = dict()
    for attr in self.__class__.attributes:
        d[attr] = getattr(self, attr)
    d['rules'] = jsonutils.loads(d['rules'])
    return d
