<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_session(self):
 """Create session as needed. .. note:: Caller is responsible for cleaning up the session after all partitions have been processed. """

        if self._session is None:
            session = self._session = self._database.session()
            session.create()
        return self._session