code: def socket_exception(func):
      """Decorator close object on socket.error."""
  
      def read(self, *args, **kwargs):
          try:
              return func(self, *args, **kwargs)
          except socket.error:
              logger.debug("ignoring socket exception", exc_info=True)
              self.close()
  
      return read
  
imports: import logging
  import select
  import socket
  import struct
  import threading
  from collections import deque
  from six.moves import queue
  from thrift.transport import TTransport
  from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
label_desc: Use image node_id 2 for calling a global function with example usage: socket_exception(func) and returns: read, func