code: def api_config(self, stage=None):
          
          if stage in self.known_api_configurations:
              return self.known_api_configurations[stage]
  
          if not stage:
              section = 'stages.live'
              api_url = 'https://api.amaas.com/'
          else:
              section = 'stages.{}'.format(stage)
              try:
                  api_url = self.lookup(section, 'api_url')
              except ConfigurationError:
                  api_url = 'https://api-{}.dev.amaas.com/'.format(stage)
  
          return APIConfig(api_url)
docs: Create api config based on stage.