code: def get_movie(tmdb_id):
      redis_key = 'm_%s' % tmdb_id
      cached = redis_ro_conn.get(redis_key)
      if cached:
          return Response(cached)
      else:
          try:
              details = get_on_tmdb(u'/movie/%d' % tmdb_id)
              cast = get_on_tmdb(u'/movie/%d/casts' % tmdb_id)
              alternative = get_on_tmdb(u'/movie/%d/alternative_titles' % tmdb_id)
          except requests.HTTPError as err:
              return Response('TMDB API error: %s' % str(err), status=err.response.status_code)
          movie = {'title': details['original_title'],
                   'score': details['popularity'],
                   'directors': [x['name'] for x in cast['crew'] if x['department'] == 'Directing' and x['job'] == 'Director'],
                   'writers': [x['name'] for x in cast['crew'] if x['department'] == 'Writing'],
                   'cast': [x['name'] for x in cast['cast']],
                   'genres': [x['name'] for x in details['genres']],
                   'countries': [x['name'] for x in details['production_countries']],
                   'tmdb_votes': int(round(details.get('vote_average', 0) * 0.5)),
                   '_tmdb_id': tmdb_id}
          if details.get('release_date'):
              movie['year'] = datetime.strptime(details['release_date'], '%Y-%m-%d').year
          if details.get('belongs_to_collection'):
              movie['collection'] = details['belongs_to_collection']['name']
          for alt in alternative['titles']:
              movie['title_%s' % alt['iso_3166_1'].lower()] = alt['title']
          json_response = json.dumps({'movie': movie})
          redis_conn.setex(redis_key, app.config['CACHE_TTL'], json_response)
          return Response(json_response)