<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def exchange_code_for_token(self, authorization_code):
 # type: (str) -> se_leg_op.access_token.AccessToken """ Exchanges an authorization code for an access token. """

        if authorization_code not in self.authorization_codes:
            raise InvalidAuthorizationCode('{} unknown'.format(authorization_code))

        authz_info = self.authorization_codes[authorization_code]
        if authz_info['used']:
            logger.debug('detected already used authz_code=%s', authorization_code)
            raise InvalidAuthorizationCode('{} has already been used'.format(authorization_code))
        elif authz_info['exp'] < int(time.time()):
            logger.debug('detected expired authz_code=%s, now=%s > exp=%s ',
                         authorization_code, int(time.time()), authz_info['exp'])
            raise InvalidAuthorizationCode('{} has expired'.format(authorization_code))

        authz_info['used'] = True

        access_token = self._create_access_token(authz_info['sub'], authz_info[self.KEY_AUTHORIZATION_REQUEST],
                                                 authz_info['granted_scope'])

        logger.debug('authz_code=%s exchanged to access_token=%s', authorization_code, access_token.value)
        return access_token