code: def socket(self):
          '''
          Lazily create the socket.
          '''
          if not hasattr(self, '_socket'):
              # create a new one
              self._socket = self.context.socket(zmq.REQ)
              if hasattr(zmq, 'RECONNECT_IVL_MAX'):
                  self._socket.setsockopt(
                      zmq.RECONNECT_IVL_MAX, 5000
                  )
  
              self._set_tcp_keepalive()
              if self.master.startswith('tcp://['):
                  # Hint PF type if bracket enclosed IPv6 address
                  if hasattr(zmq, 'IPV6'):
                      self._socket.setsockopt(zmq.IPV6, 1)
                  elif hasattr(zmq, 'IPV4ONLY'):
                      self._socket.setsockopt(zmq.IPV4ONLY, 0)
              self._socket.linger = self.linger
              if self.id_:
                  self._socket.setsockopt(zmq.IDENTITY, self.id_)
              self._socket.connect(self.master)
          return self._sockef socket(self):
          '''
          Lazily create the socket.
          '''
          if not hasattr(self, '_socket'):
              # create a new one
              self._socket = self.context.socket(zmq.REQ)
              if hasattr(zmq, 'RECONNECT_IVL_MAX'):
                  self._socket.setsockopt(
                      zmq.RECONNECT_IVL_MAX, 5000
                  )
  
              self._set_tcp_keepalive()
              if self.master.startswith('tcp://['):
                  # Hint PF type if bracket enclosed IPv6 address
                  if hasattr(zmq, 'IPV6'):
                      self._socket.setsockopt(zmq.IPV6, 1)
                  elif hasattr(zmq, 'IPV4ONLY'):
                      self._socket.setsockopt(zmq.IPV4ONLY, 0)
              self._socket.linger = self.linger
              if self.id_:
                  self._socket.setsockopt(zmq.IDENTITY, self.id_)
              self._socket.connect(self.master)
          return self._socket
docs: Lazily create the socket.