In my module, I'd like to do something like when defined(nre): import nre # code that works with regular expressions
so, if the user does import nre import my_module then that code gets compiled, but if the user doesn't use nre, then we aren't going to uselessly import it or compile the related code in my_module. Is something like that possible?