Granular field data may report measurements such as acres, hectares, feet, and meters. Given known conversion relationships, implement a function that converts a value from one unit to another, even when no direct relationship is provided.
Model each unit as a graph node. A conversion A -> B with factor f means one unit of A equals f units of B. The reverse relationship has factor 1 / f. Return None when the source and target units are disconnected.
Implement convert_units(value, source, target, conversions).
value is a real number.source and target are non-empty unit-name strings.conversions is a list of three-element lists [unit_a, unit_b, factor], where factor is positive and means 1 unit_a = factor unit_b.value in target units. Return value unchanged when source == target. Return None if no path exists.def convert_units(value, source, target, conversions):