code: def id_mods(obj,modlist,intrinsic_mods={},submodlist=[]):
      
      for i in range(len(obj.uses)):
          for candidate in modlist:
              if obj.uses[i][0].lower() == candidate.name.lower():
                  obj.uses[i] = [candidate, obj.uses[i][1]]
                  break
          else:
              if obj.uses[i][0].lower() in intrinsic_mods:
                  obj.uses[i] = [intrinsic_mods[obj.uses[i][0].lower()], obj.uses[i][1]]
                  continue
      if getattr(obj,'ancestor',None):
          for submod in submodlist:
              if obj.ancestor.lower() == submod.name.lower():
                  obj.ancestor = submod
                  break
      if hasattr(obj,'ancestor_mod'):
          for mod in modlist:
              if obj.ancestor_mod.lower() == mod.name.lower():
                  obj.ancestor_mod = mod
                  break
      for modproc in getattr(obj,'modprocedures',[]):
          id_mods(modproc,modlist,intrinsic_mods)
      for func in getattr(obj,'functions',[]):
          id_mods(func,modlist,intrinsic_mods)
      for subroutine in getattr(obj,'subroutines',[]):
          id_mods(subroutine,modlist,intrinsic_mods)
docs: Match USE statements up with the right modules