I'm not aware of a way to query the queue size in rospy or roscpp.
This is made more complicated by the fact that queues are maintained on a per-connection basis, rather than a per-topic basis, so each publisher may have multiple queues, and each subscriber may have multiple queues.
The sequence number from a particular publisher should increase by 1 for every message, so that's a start towards determining if messages have been dropped, but if there are two publishers on a topic, each will have its own series of sequence numbers, and if a publisher is restarted, the sequence will probably restart from 0. You could probably use the meta-info about a message to determine which publisher a message came from, and track the sequence numbers for each publisher separately.