Implementation of Bond Energy Algorithm in Python