Should this not happen at the top level of the module, so that the patching happens before any other imports?