<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _boto_conn_kwargs(self):
 """ Generate keyword arguments for boto3 connection functions. If ``self.account_id`` is defined, this will call :py:meth:`~._get_sts_token` to get STS token credentials using `boto3.STS.Client.assume_role <https://boto3.readthedocs.org/en/ latest/reference/services/sts.html#STS.Client.assume_role>`_ and include those credentials in the return value. If ``self.profile_name`` is defined, this will call `boto3.Session() <http://boto3.readthedocs.io/en/latest/reference/core/session.html>` with that profile and include those credentials in the return value. :return: keyword arguments for boto3 connection functions :rtype: dict """

        kwargs = {'region_name': self.region}
        if self.account_id is not None:
            logger.debug("Connecting for account %s role '%s' with STS "
                         "(region: %s)", self.account_id, self.account_role,
                         self.region)
            credentials = self._get_sts_token()
            kwargs['aws_access_key_id'] = credentials.access_key
            kwargs['aws_secret_access_key'] = credentials.secret_key
            kwargs['aws_session_token'] = credentials.session_token
        elif self.profile_name is not None:
            # use boto3.Session to get credentials from the named profile
            logger.debug("Using credentials profile: %s", self.profile_name)
            session = boto3.Session(profile_name=self.profile_name)
            credentials = session._session.get_credentials()
            kwargs['aws_access_key_id'] = credentials.access_key
            kwargs['aws_secret_access_key'] = credentials.secret_key
            kwargs['aws_session_token'] = credentials.token
        else:
            logger.debug("Connecting to region %s", self.region)
        return kwargs