input: Write a python function to search files based on a query using TFIDF vectorization.
  assert search('sample query')=='samplefile.txt'
  assert search('another test')=='testfile.txt'
  assert search('data science')=='datasciencefile.txt'
output: def search(query):
      import os
      from sklearn.feature_extraction.text import TfidfVectorizer
      from sklearn.metrics.pairwise import cosine_similarity
      
      # Directory containing files to search in
      directory = 'path_to_files_directory'
      
      # Read all files and store their contents
      documents = []
      filenames = []
      for filename in os.listdir(directory):
          if filename.endswith(".txt"):
              with open(os.path.join(directory, filename), 'r', encoding='utf-8') as file:
                  documents.append(file.read())
                  filenames.append(filename)
      
      # Initialize the TFIDF Vectorizer
      vectorizer = TfidfVectorizer()
      tfidf_matrix = vectorizer.fit_transform(documents)
      
      # Transform the query using the same vectorizer
      query_tfidf = vectorizer.transform([query])
      
      # Calculate cosine similarity between the query and the documents
      cosine_similarities = cosine_similarity(query_tfidf, tfidf_matrix).flatten()
      
      # Find the index of the document with the highest similarity score
      best_match_index = cosine_similarities.argmax()
      
      # Return the filename of the best matching document
      return filenames[best_match_index]