This is a standard function and useful for applications. Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>