def METHOD_NAME(job, output):
    """
    The output has the following format:
      Currently Loaded Modulefiles:
        1) module1
        2) module2
        ...
      OR
      Currently Loaded Modules:
        1) module1
        2) module2
        ...
    """
    lines_match = re.search(r"(?<=^Currently Loaded Modulefiles:$)(\s+\d+\) (.*))+", output, flags=re.MULTILINE)
    if not lines_match:
        lines_match = re.search(r"(?<=^Currently Loaded Modules:$)(\s+\d+\) (.*))+", output, flags=re.MULTILINE)
        if not lines_match:
            mod_obj, created = models.LoadedModule.objects.get_or_create(name="None")
            job.loaded_modules.add(mod_obj)
            return
    modules = lines_match.group(0)
    # Assume that the module names don't have whitespace. Then "split" will have the module
    # names alternating with the "\d+)"
    mod_list = modules.split()[1::2]
    for mod in mod_list:
        mod_obj, created = models.LoadedModule.objects.get_or_create(name=mod)
        job.loaded_modules.add(mod_obj)
    if not mod_list:
        mod_obj, created = models.LoadedModule.objects.get_or_create(name="None")
        job.loaded_modules.add(mod_obj)