python function to assign bond orders from a template molecule