How to use ERPnext internal Currency Exchange Rate Function

ERPnext has inbuilt a function to fetch the currency exchange rate. How can I access that function if I want to use it for my own custom app?