parameters: (func)
return_statement: return read
docstring: Decorator close object on socket.error.
docstring_summary: Decorator close object on socket.error.
docstring_tokens: Decorator close object on socket . error .
function: def socket_exception(func):
      "Decorator close object on socket.error."
      def read(self, *args, **kwargs):
          try:
              return func(self, *args, **kwargs)
          except socket.error:
              self.close()
      return read
function_tokens: def socket_exception ( func ) : def read ( self , * args , * * kwargs ) : try : return func ( self , * args , * * kwargs ) except socket . error : self . close ( ) return read