<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _session(kwargs):
 """Returns or reuses session. Method takes care of providing instance of session object for the client. :param kwargs: all params (without api_version) client was initialized with :type kwargs: dict :returns: session object :rtype keystoneauth1.session.Session """

    if 'session' in kwargs:
        LOG.debug('Reusing session')
        sess = kwargs.get('session')
        if not isinstance(sess, k_session.Session):
            msg = ('session should be an instance of %s' % k_session.Session)
            LOG.error(msg)
            raise RuntimeError(msg)
    else:
        LOG.debug('Initializing new session')
        auth = _get_auth_handler(kwargs)
        sess = _get_session(auth, kwargs)
    return sess