How to find a blog in a Multi-DB

How do I figure out which database a specific blog resides in? (in Multi-DB)
Is there a function or algorithm you can share? Thanks.