fixed indentation
extracted common functionality to utility_functions.py