You might be able to do this with decorators in Python, but in Ruby (1.9 or 1.8 w/ the fibers patch) there are libraries that make these calls asynchronous with minimal or no changes to your code, e.g., neverblock.
http://www.espace.com.eg/neverblock/