<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def stop(config, container, timeout=10, *args, **kwargs):
    '''
    Stop a running container

    :type container: string
    :param container: The container id to stop

    :type timeout: int
    :param timeout: Wait for a timeout to let the container exit gracefully
        before killing it

    :rtype: dict
    :returns: boolean
    '''
    err = "Unknown"
    client = _get_client(config)
    try:
        dcontainer = _get_container_infos(config, container)['Id']
        if is_running(config, dcontainer):
            client.stop(dcontainer, timeout=timeout)
            if not is_running(config, dcontainer):
                print "Container stopped."
                return True
            else:
                i = 0
                while is_running(config, dcontainer):
                    time.sleep(0.1)
                    if i > 100:
                        return kill(config,container)
                    i += 1
                return True
        else:
            return True
    except Exception as e:
        err = e
    utils.warning("Container not existing")
    return True