How to use the next-generation spaced repetition algorithm FSRS on Anki?

If anyone is using my edit of “deck and card info sidebar during review”, the difficulty it shows is apparently wrong: the code recently added to FSRS4Helper calculates it differently.