A nitpick: As this function is specific to `LVPersonalCodeField`, I'd suggest adding it as a (perhaps static) method to the field class. There's no use from it being a module-level function.