<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove(self, safe=None):
 """Removes the document itself from database. The optional ``safe`` argument is a boolean that specifies if the remove method should wait for the operation to complete. """

        self._session.remove(self, safe=None)
        self._session.flush()