<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hydrate(self, database, recursive=True):
 """ By default, recursively reloads all instances of Document in the model. Recursion can be turned off. :param database: the `Database` object source for rehydrating. :return: an updated instance of `Document` / self. """

        if isinstance(self, Document):
            self.reload(database)
        for field in self:
            obj = getattr(self, field)
            if isinstance(obj, Document):
                obj.reload(database)
                if recursive:
                    obj.hydrate(database)
        return self