You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: job.go
    path of file: ./repos/erda/internal/tools/orchestrator/scheduler/executor/plugins/k8s/job
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CON
    
func (j *Job) List(namespace string, labelSelector map[string]string) (batchv1.JobList, error) {
	var jobList batchv1.JobList
	var params url.Values
	if len(labelSelector) > 0 {
		var kvs []string
		params = make(url.Values, 0)

		for key, value := range labelSelector {
			kvs = append(kvs, fmt.Sprintf("%s=%s", key, value))
		}
		params.Add("labelSelector", strings.Join(kvs, ","))
	}
	var b bytes.Buffer
	resp, err := j.client.Get(j.addr).
		Path("/apis/batch/v1/namespaces/" + namespace + "/jobs").
		Params(params).
		Do().
		Body(&b)

	if err != nil {
		return jobList, errors.Errorf("failed to get job list, ns: %s, (%v)", namespace, err)
	}

	if !resp.IsOK() {
		if resp.IsNotfound() {
			return jobList, k8serror.ErrNotFound
		}
		return jobList, errors.Errorf("failed to get job list, ns: %s, statuscode: %v, body: %v",
			namespace, resp.StatusCode(), b.String())
	}

	if err := json.NewDecoder(&b).Decode(&jobList); err != nil {
		return jobList, err
	}
	return jobList, nil
}