<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, session):
 """Creates a new session with basic auth, unless one was provided, and sets headers. :param session: (optional) Session to re-use :return: - :class:`requests.Session` object """


        if not session:
            logger.debug('(SESSION_CREATE) User: %s' % self._user)
            s = requests.Session()
            s.auth = HTTPBasicAuth(self._user, self._password)
        else:
            logger.debug('(SESSION_CREATE) Object: %s' % session)
            s = session

        s.headers.update(
            {
                'content-type': 'application/json',
                'accept': 'application/json',
                'User-Agent': 'pysnow/%s' % pysnow.__version__
            }
        )

        return s