'Create kernel manager and client.'

def create_kernel_manager_and_kernel_client(self, connection_file, stderr_file):

    kernel_spec = self.create_kernel_spec()
    if (not kernel_spec.env.get('PYTHONPATH')):
        error_msg = _('This    error    was    most    probably    caused    by    installing    Spyder    in    a    directory    with    non-ascii    characters    (i.e.    characters    with    tildes,    apostrophes    or    non-latin    symbols).<br><br>To    fix    it,    please    <b>reinstall</b>    Spyder    in    a    different    location.')
        return (error_msg, None)
    kernel_manager = QtKernelManager(connection_file=connection_file, config=None, autorestart=True)
    kernel_manager._kernel_spec = kernel_spec
    stderr = codecs.open(stderr_file, 'w', encoding='utf-8')
    kernel_manager.start_kernel(stderr=stderr)
    kernel_client = kernel_manager.client()
    kernel_client.hb_channel.time_to_dead = 6.0
    return (kernel_manager, kernel_client)
