input: Write a python function to lemmatize and filter a sentence based on given stopwords and POS tags.
  assert lemmatize_and_filter("Computer Science is awesome!", ["MD", "NN", "VB", "NNS"], set(stopwords.words('english'))) == "computer science awesome !"
  assert lemmatize_and_filter("The quick brown fox jumps over the lazy dog", ["JJ", "NN", "VB", "NNS"], set(stopwords.words('english'))) == "quick brown fox jump lazy dog"
  assert lemmatize_and_filter("NLTK is a leading platform for building Python programs to work with human language data", ["MD", "NN", "VB", "NNS"], set(stopwords.words('english'))) == "nltk leading platform building python program work human language data"
output: import nltk
  from nltk.corpus import stopwords
  from nltk.tokenize import word_tokenize
  from nltk.tag import pos_tag
  from nltk.stem import WordNetLemmatizer
  from nltk.corpus import wordnet
  
  nltk.download('punkt')
  nltk.download('averaged_perceptron_tagger')
  nltk.download('wordnet')
  nltk.download('stopwords')
  
  def get_wordnet_pos(treebank_tag):
      if treebank_tag.startswith('J'):
          return wordnet.ADJ
      elif treebank_tag.startswith('V'):
          return wordnet.VERB
      elif treebank_tag.startswith('N'):
          return wordnet.NOUN
      elif treebank_tag.startswith('R'):
          return wordnet.ADV
      else:
          return None
  
  def lemmatize_and_filter(sentence, pos_tags, stop_words):
      lemmatizer = WordNetLemmatizer()
      words = word_tokenize(sentence)
      words_pos = pos_tag(words)
  
      filtered_words = []
      for word, pos in words_pos:
          wordnet_pos = get_wordnet_pos(pos) or wordnet.NOUN
          lemmatized_word = lemmatizer.lemmatize(word.lower(), pos=wordnet_pos)
          if pos in pos_tags and lemmatized_word not in stop_words:
              filtered_words.append(lemmatized_word)
  
      return ' '.join(filtered_words)