code: def identify(self):
          
          self.send(nsq.identify({
              # nsqd 0.2.28+
              'client_id': self.client_id,
              'hostname': self.hostname,
  
              # nsqd 0.2.19+
              'feature_negotiation': True,
              'heartbeat_interval': self.heartbeat_interval,
  
              # nsqd 0.2.21+
              'output_buffer_size': self.output_buffer_size,
              'output_buffer_timeout': self.output_buffer_timeout,
  
              # nsqd 0.2.22+
              'tls_v1': self.tls_v1,
  
              # nsqd 0.2.23+
              'snappy': self.snappy,
              'deflate': self.deflate,
              'deflate_level': self.deflate_level,
  
              # nsqd nsqd 0.2.25+
              'sample_rate': self.sample_rate,
              'user_agent': self.user_agent,
          }))
  
          frame, data = self.read_response()
  
          if frame == nsq.FRAME_TYPE_ERROR:
              raise data
  
          if data == nsq.OK:
              return
  
          try:
              data = json.loads(data.decode('utf-8'))
  
          except ValueError:
              self.close_stream()
              raise errors.NSQException(
                  'failed to parse IDENTIFY response JSON from nsqd: '
                  '{!r}'.format(data))
  
          self.max_ready_count = data.get('max_rdy_count', self.max_ready_count)
  
          if self.tls_v1 and data.get('tls_v1'):
              self.upgrade_to_tls()
  
          if self.snappy and data.get('snappy'):
              self.upgrade_to_snappy()
  
          elif self.deflate and data.get('deflate'):
              self.deflate_level = data.get('deflate_level', self.deflate_level)
              self.upgrade_to_defalte()
  
          if self.auth_secret and data.get('auth_required'):
              self.auth()
  
          return data
docs: Update client metadata on the server and negotiate features.
  
          :returns: nsqd response data if there was feature negotiation,
              otherwise ``None``