[M] Change in pysim[master]: card_key_provider: move boiler-plate code into helper functions