I extracted a patch from my FAT Python project to implement the PEP 510:
https://bugs.python.org/issue26098
FYI I also extracted the runtime part of the FAT Python optimizer and
put it on GitHub:
https://github.com/haypo/fat
The fat module provides specialize(), get_specialized() and
replace_consts() functions, but also 6 different guards: GuardArgType,
GuardBuiltins, GuardDict, GuardFunc, GuardGlobals, GuardTypeDict.
Victor