code: def attempt_open_query_permutations(url, orig_file_path, is_header_file):
      directory = dirname(convert_to_platform_safe(orig_file_path)) + "/"
      try:
          filenames = [f for f in os.listdir(directory)
                       if isfile(join(directory, f))]
      except OSError:
          return
      if is_header_file:
          filenames = [f for f in filenames if ".http-headers" in f]
          filenames = [f for f in filenames if
                       _compare_file_name(orig_file_path + ".http-headers",
                                          directory,
                                          f)]
      else:
          filenames = [f for f in filenames if ".http-headers" not in f]
          filenames = [f for f in filenames if _compare_file_name(orig_file_path,
                                                                  directory,
                                                                  f)]
      url_parts = url.split("/")
      url_parts = url_parts[len(url_parts) - 1].split("?")
      base = url_parts[0]
      params = url_parts[1]
      params = params.split("&")
      filenames = [f for f in filenames if f.startswith(base)]
      params = [convert_to_platform_safe(unquote(p)) for p in params]
      for param in params:
          filenames = [f for f in filenames if param in f]
      if len(filenames) == 1:
          path = join(directory, filenames[0])
          return open_file(path)
      if len(filenames) > 1:
          raise DataFailureException(url,
                                     "Multiple mock data files matched the " +
                                     "parameters provided!",
                                     404)