text: """
  models.py is generated by flask-sqlacodegen
  pip3 install flask-sqlacodegen
  flask-sqlacodegen --flask --outfile models.py mysql+pymysql://user-name:password@host:port/db-schema
  reference: https://www.devmashup.com/generating-flask-sqlalchemy-models-with-flask-sqlacodegen/
  """
  from flask import Blueprint
  from business.config import Config
  from business.models import Player
  from business.models import TeamPlayer
  from business.models import Team
  from business.models import TeamsExtra
  import json
  import logging
  
  
  teams = Blueprint('teams', __name__)
  configuration = Config()
  configuration.log_init()
  logger = logging.getLogger()
  
  
  @teams.route("/api/team/<string:team_id>")
  def team(team_id):
      """
      :param team_id:
      :return:
      res = {
          "meta": {
              "code": 200
          },
          "data": {
              "team_id": team_id,
              "team_name": "Houston Rockets",
              "logo": "tiny_url",
              "big_logo": "tiny_url",
              "location": "Houston",
              "stadium": "Toyota Center",
              "players": [
                  "1302", "1201", "1336"
              ],
              "owner": "Tilman Fertitta",
              "coach": "Mike D'Antoni",
              "manager": "XXX",
              "description": "https://en.wikipedia.org/wiki/Houston_Rockets",
              "achievement": "XXXXXXXXXX"
          }
      }
      """
      team_id_temp = int(team_id)
      team_temp = Team.query.filter_by(id=team_id_temp).first()
      team_extra_temp = TeamsExtra.query.filter_by(id=team_id_temp).first()
      team_player_temp = TeamPlayer.query.filter_by(team_id=team_id_temp)
      players_in_a_team = []
      for team_player in team_player_temp:
          players_in_a_team.append(str(team_player.player_id))
      res = {
          "meta": {
              "code": 200
          },
          "data": {
              "team_id": team_id,
              "team_name": team_temp.name,
              "logo": team_temp.logo,
              "big_logo": team_temp.big_logo,
              "location": team_temp.location,
              "stadium": team_extra_temp.stadium,
              "players": players_in_a_team,
              "owner": team_extra_temp.owner,
              "coach": team_extra_temp.coach,
              "manager": team_extra_temp.manager,
              "description": team_temp.description,
              "achievement": team_extra_temp.achievement
          }
      }
      return json.dumps(res)
  
  
  @teams.route("/api/top-teams/<int:number_of_teams>")
  def top_teams(number_of_teams):
      """
      :param number_of_teams:
      teams_list = []
      for i in range(0, number_of_teams):
          temp_team = {
              "team_id": "1301",
              "team_name": "Houston Rockets",
              "location": "Houston",
              "logo": "https://d2p3bygnnzw9w3.cloudfront.net/req/201811271/tlogo/bbr/HOU.png"
          }
          teams_list.append(temp_team)
      res = {
          "meta": {
              "code": 200
          },
          "data": teams_list
      }
      return json.dumps(res)
      :return:
      """
      teams_name_list = configuration.TOP20_TEAMS
      teams_list = []
      for i in range(0, number_of_teams):
          team_name = teams_name_list[i]
          logger.debug(team_name)
          team_temp = Team.query.filter_by(name=team_name).first()
          team = {
              "team_id": str(team_temp.id),
              "team_name": team_name,
              "location": team_temp.location,
              "logo": team_temp.logo,
              "big_logo": team_temp.big_logo,
          }
          teams_list.append(team)
      res = {
          "meta": {
              "code": 200
          },
          "data": teams_list
      }
      return json.dumps(res)