code: def _update_flags(compiler_flags, remove_flags=()):
      
      for flag in GFORTRAN_SHARED_FLAGS:
          if flag not in compiler_flags:
              compiler_flags.append(flag)
      if DEBUG_ENV in os.environ:
          to_add = GFORTRAN_DEBUG_FLAGS
          to_remove = GFORTRAN_OPTIMIZE_FLAGS
      else:
          to_add = GFORTRAN_OPTIMIZE_FLAGS
          if os.environ.get(WHEEL_ENV) is None:
              to_add += (GFORTRAN_NATIVE_FLAG,)
          to_remove = GFORTRAN_DEBUG_FLAGS
      for flag in to_add:
          if flag not in compiler_flags:
              compiler_flags.append(flag)
      return [
          flag
          for flag in compiler_flags
          if not (flag in to_remove or flag in remove_flags)
      ]
docs: Update a given set of compiler flags.
  
      Args:
          compiler_flags (List[str]): Existing flags associated with a compiler.
          remove_flags (Optional[Container[str]]): A container of flags to remove
              that will override any of the defaults.
  
      Returns:
          List[str]: The modified list (i.e. some flags added and some removed).