input: Write a python function to tokenize a given text using BERT tokenizer and analyze the sentiment using model's polarity scores.
  assert tokenize_and_analyze_sentiment('I love programming!') == {'tokens': ['I', 'love', 'programming', '!'], 'sentiments': {'neg': 0.0, 'neu': 0.453, 'pos': 0.547, 'compound': 0.854}}
  assert tokenize_and_analyze_sentiment('This is terrible.') == {'tokens': ['This', 'is', 'terrible', '.'], 'sentiments': {'neg': 0.576, 'neu': 0.424, 'pos': 0.0, 'compound': -0.761}}
output: def tokenize_and_analyze_sentiment(text):
      from transformers import BertTokenizer, BertForSequenceClassification
      from transformers import pipeline
  
      # Load pre-trained model and tokenizer
      tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
      model = BertForSequenceClassification.from_pretrained('nlptown/bert-base-multilingual-uncased-sentiment')
  
      # Tokenize the input text
      tokens = tokenizer.tokenize(text)
  
      # Analyze the sentiment
      sentiment_pipeline = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
      sentiment = sentiment_pipeline(text)[0]
  
      # Map sentiment scores to the expected format
      polarity_scores = {
          'neg': sentiment['score'] if sentiment['label'] == '1 star' else 0.0,
          'neu': sentiment['score'] if sentiment['label'] == '3 stars' else 0.0,
          'pos': sentiment['score'] if sentiment['label'] == '5 stars' else 0.0,
          'compound': sentiment['score'] if sentiment['label'] in ['1 star', '5 stars'] else 0.0
      }
  
      return {'tokens': tokens, 'sentiments': polarity_scores}