input: Write a function to analyze the sentiment of given text. The function should categorize the text into positive, negative, and neutral sentiments. The function should be named analyze_sentiment and take a single string argument text. If the number of positive sentences is greater than the number of negative sentences, the function should return 'positive'. If the number of negative sentences is greater than the number of positive sentences, the function should return 'negative'. If the number of positive and negative sentences is equal, the function should return 'neutral'.
  
  import nltk
  from nltk.tokenize import sent_tokenize
  from nltk.classify import NaiveBayesClassifier
  
  def analyze_sentiment(text):
      sents = sent_tokenize(text)
      neg = 0
      pos = 0
      for sentence in sents:
          sentiment_analysis = NaiveBayesClassifier.classify(sentence)
          if sentiment_analysis == 'neg':
              neg += 1
          if sentiment_analysis == 'pos':
              pos += 1
      
      if neg > pos:
          sentiment = 'negative'
      elif pos > neg:
          sentiment = 'positive'
      else:
          sentiment = 'neutral'
      
      return sentiment
  
  assert analyze_sentiment("I love this movie. It's amazing.")=='positive'
  assert analyze_sentiment("I hate this movie. It's terrible.")=='negative'
  assert analyze_sentiment("This movie is okay.")=='neutral'
output: def analyze_sentiment(text):
      sents = sent_tokenize(text)
      neg = 0
      pos = 0
      for sentence in sents:
          sentiment_analysis = NaiveBayesClassifier.classify(sentence)
          if sentiment_analysis == 'neg':
              neg += 1
          if sentiment_analysis == 'pos':
              pos += 1
      
      if neg > pos:
          sentiment = 'negative'
      elif pos > neg:
          sentiment = 'positive'
      else:
          sentiment = 'neutral'
      
      return sentiment