code: def get_swagger_objects(settings, route_info, registry):
      
      enabled_swagger_versions = get_swagger_versions(registry.settings)
      schema12 = registry.settings['pyramid_swagger.schema12']
      schema20 = registry.settings['pyramid_swagger.schema20']
  
      fallback_to_swagger12_route = (
          SWAGGER_20 in enabled_swagger_versions and
          SWAGGER_12 in enabled_swagger_versions and
          settings.prefer_20_routes and
          route_info.get('route') and
          route_info['route'].name not in settings.prefer_20_routes
      )
      if fallback_to_swagger12_route:
          return settings.swagger12_handler, schema12
  
      if SWAGGER_20 in enabled_swagger_versions:
          return settings.swagger20_handler, schema20
  
      if SWAGGER_12 in enabled_swagger_versions:
          return settings.swagger12_handler, schema12
docs: Returns appropriate swagger handler and swagger spec schema.
  
      Swagger Handler contains callables that isolate implementation differences
      in the tween to handle both Swagger 1.2 and Swagger 2.0.
  
      Exception is made when `settings.prefer_20_routes` are non-empty and
      ['1.2', '2.0'] both are present in available swagger versions. In this
      special scenario, '2.0' spec is chosen only for requests which are listed
      in the `prefer_20_routes`. This helps in incremental migration of
      routes from v1.2 to v2.0 by making moving to v2.0 opt-in.
  
      :rtype: (:class:`SwaggerHandler`,
               :class:`pyramid_swagger.model.SwaggerSchema` OR
                  :class:`bravado_core.spec.Spec`)