code: def register_flag_by_module(self, module_name, flag):
      
      flags_by_module = self.flags_by_module_dict()
      flags_by_module.setdefault(module_name, []).append(flag)
docs: Records the module that defines a specific flag.
  
      We keep track of which flag is defined by which module so that we
      can later sort the flags by module.
  
      Args:
        module_name: str, the name of a Python module.
        flag: Flag, the Flag instance that is key to the module.