That Python code does not appear to accept the frequency as a float, such as 868.1Mhz, looks like the calculation to split the frequency into the 3 register values has been manually calculated outside and given as three bytes in a table. But then I am not a Python expert.
The frequency on an SX1276 is a 24bit value spread across 3 x 8 bit registers. The total HEX value is;
Value in HEX = frequencyhz / 61.03515625
So for 868.1Mhz;
Value in HEX = 868100000 / 61.03515625 = 14222950 = 0xD90666
For a bandwidth of 125000hz, as used on TTN, the specified capture range of 25% of the bandwidth is 31250hz, i.e. if RX and TX are apart by this then there is no guaranteed reception.
In practice it seems that you can get problems around the 22% of bandwidth range.
The frequency tolerance of the crystals used on typical SX127x modules can lead to same temperature variation of maybe 16000hz between modules @ 868Mhz so still well within the 31250hz specified.
Note however that for the devices that can operate at 7800hz bandwidth, such as the SX126x modules that have a TCXO, 25% of bandwith is only 1950hz. Thats within the scope of the TCXO, but the base calculation needs to be a bit more accurate that a 2258hz difference.