code: def close_all(map=None, ignore_all=False):
      if map is None:
          map = socket_map
      for x in list(map.values()):
          try:
              x.close()
          except OSError as x:
              if x.errno == EBADF:
                  pass
              elif not ignore_all:
                  raise
          except _reraised_exceptions:
              raise
          except:
              if not ignore_all:
                  raise
      map.clear()
  
imports: import select
  import socket
  import sys
  import time
  import warnings
  import os
  from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, errorcode
label_desc: Use image node_id 10 for calling a global function with example usage: close_all(map, ignore_all) without return types