code: def stop_docker(name="streamz-kafka", cid=None, let_fail=False):
      """Stop docker container with given name tag
  
      Parameters
      ----------
      name: str
          name field which has been attached to the container we wish to remove
      cid: str
          container ID, if known
      let_fail: bool
          whether to raise an exception if the underlying commands return an
          error.
      """
      try:
          if cid is None:
              print("Finding %s ..." % name)
              cmd = shlex.split(
                  'docker ps -q --filter "name=%s"' % name
              )
              cid = subprocess.check_output(cmd).strip().decode()
          if cid:
              print("Stopping %s ..." % cid)
              subprocess.call(["docker", "rm", "-f", cid])
      except subprocess.CalledProcessError as e:
          print(e)
          if not let_fail:
              raise
  
imports: import asyncio
  import atexit
  from contextlib import contextmanager
  from flaky import flaky
  import os
  import pytest
  import random
  import shlex
  import subprocess
  import time
  from tornado import gen
  from ..core import Stream
  from ..dask import DaskStream
  from streamz.utils_test import gen_test, wait_for, await_for
  from distributed.utils_test import gen_cluster
label_desc: Use image node_id 1 for calling a global function with example usage: stop_docker(name, cid, let_fail) without return types