<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_api_doc_endpoints(config, endpoints, base_path='/api-docs'):
 """Create and register pyramid endpoints to service swagger api docs. Routes and views will be registered on the `config` at `path`. :param config: a pyramid configuration to register the new views and routes :type config: :class:`pyramid.config.Configurator` :param endpoints: a list of endpoints to register as routes and views :type endpoints: a list of :class:`pyramid_swagger.model.PyramidEndpoint` :param base_path: the base path used to register api doc endpoints. Defaults to `/api-docs`. :type base_path: string """

    for endpoint in endpoints:
        path = base_path.rstrip('/') + endpoint.path
        config.add_route(endpoint.route_name, path)
        config.add_view(
            endpoint.view,
            route_name=endpoint.route_name,
            renderer=endpoint.renderer)