Yes, that does look a bit wrong.

Presumably, the idea is that 'coord_to_differentiate' may belong to a different cube, and we want to choose the "matching" one from 'cube'.
It seems to me like the "right" way to do that would be to use a coordinate definition, in line 209 ?
From:
   ```coord = coord_to_differentiate```
To:
   ```coord = cube.coord(coord_to_differentiate._as_defn())```

Strictly, that concept is not public.
But according to my search, it is already used in modules : _concatenate, _merge, cube, iterate and plot.