docs: def attempt_open_query_permutations(url, orig_file_path, is_header_file):
      """
      Attempt to open a given mock data file with different permutations of the
      query parameters
      """
      directory = dirname(convert_to_platform_safe(orig_file_path)) + "/"
  
      # get all filenames in directory
      try:
          filenames = [f for f in os.listdir(directory)
                       if isfile(join(directory, f))]
      except OSError:
          return
  
      # ensure that there are not extra parameters on any files
      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("&")
  
      # check to ensure that the base url matches
      filenames = [f for f in filenames if f.startswith(base)]
  
      params = [convert_to_platform_safe(unquote(p)) for p in params]
  
      # ensure that all parameters are there
      for param in params:
          filenames = [f for f in filenames if param in f]
  
      # if we only have one file, return it
      if len(filenames) == 1:
          path = join(directory, filenames[0])
          return open_file(path)
  
      # if there is more than one file, raise an exception
      if len(filenames) > 1:
          raise DataFailureException(url,
                                     "Multiple mock data files matched the " +
                                     "parameters provided!",
                                     404)