This is possible! You can use Dinnerbone's own implementation.
This basic Python script should do what you want (using hypixel as an example):
from mcstatus import MinecraftServer
server = MinecraftServer.lookup("mc.hypixel.net")
status = server.status()
print("The server has {0} players and replied in {1} ms".format(status.players.online, status.latency))
latency = server.ping()
print("The server replied in {0} ms".format(latency))
There's heaps more you can do, check it out: https://github.com/Dinnerbone/mcstatus
You can install this package by running:
python3 -m pip install mcstatus
Also note that according to the Github repo, this will only work on servers above version 1.7 :)