def METHOD_NAME(self, request, repo_id, format=None):
    """ restore a deleted library
    Permission checking:
    1. only admin can perform this action.
    """
    if not request.user.admin_permissions.can_manage_library():
        return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.')
    if not seafile_api.get_trash_repo_owner(repo_id):
        error_msg = "Library does not exist in trash."
        return api_error(status.HTTP_404_NOT_FOUND, error_msg)
    try:
        seafile_api.restore_repo_from_trash(repo_id)
    except SearpcError as e:
        logger.error(e)
        error_msg = 'Internal Server Error'
        return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg)
    return Response({'success': True})