code: def update_domain_base_path_mapping(self, domain_name, lambda_name, stage, base_path):
          
          api_id = self.get_api_id(lambda_name)
          if not api_id:
              print("Warning! Can't update base path mapping!")
              return
          base_path_mappings = self.apigateway_client.get_base_path_mappings(domainName=domain_name)
          found = False
          for base_path_mapping in base_path_mappings.get('items', []):
              if base_path_mapping['restApiId'] == api_id and base_path_mapping['stage'] == stage:
                  found = True
                  if base_path_mapping['basePath'] != base_path:
                      self.apigateway_client.update_base_path_mapping(domainName=domain_name,
                                                                      basePath=base_path_mapping['basePath'],
                                                                      patchOperations=[
                                                                          {"op" : "replace",
                                                                           "path" : "/basePath",
                                                                           "value" : '' if base_path is None else base_path}
                                                                      ])
          if not found:
              self.apigateway_client.create_base_path_mapping(
                  domainName=domain_name,
                  basePath='' if base_path is None else base_path,
                  restApiId=api_id,
                  stage=stage
              )
docs: Update domain base path mapping on API Gateway if it was changed