'Return a dictionary with model\'s attributes.
overrides the `to_dict` function from the base class
to avoid having an `extra` field.'

def to_dict(self):

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