Extract create_and_define_method  from ModuleObject