Added python code for HF algorithm