code: def a2s_ping(server_addr, timeout=2):
      
      ss = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      ss.connect(server_addr)
      ss.settimeout(timeout)
  
      ss.send(_pack('<lc', -1, b'i'))
      start = _time()
  
      try:
          data = _handle_a2s_response(ss)
      finally:
          ss.close()
  
      ping = max(0.0, _time() - start) * 1000
  
      if data[4:5] == b'j':
          return ping
docs: Ping a server
  
      .. warning::
          This method for pinging is considered deprecated and may not work on certian servers.
          Use :func:`.a2s_info` instead.
  
      :param server_addr: (ip, port) for the server
      :type  server_addr: tuple
      :param timeout: (optional) timeout in seconds
      :type  timeout: float
      :raises: :class:`RuntimeError`, :class:`socket.timeout`
      :returns: ping response in milliseconds or `None` for timeout
      :rtype: :class:`float`