<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Managing kubernetes objects using common resource operations with the python client
Some of these operations include;
create_xxxx 
Step1:  Load config from default location.
Step2:  Create API endpoint instance as well as API resource instances (body and specification).
Step3:  Fill required object fields (apiVersion, kind, metadata and spec).
Step4:  Create Deployment using create_xxxx command for Deployments.
Step5:  Use list_xxxx command for Deployment, to list Deployments.
Step6:  Use read_xxxx command for Deployment, to display the detailed state of the created Deployment resource.
Step7:  Use patch_xxxx command for Deployment, to make specific update to the Deployment.
Step8:  Use replace_xxxx command for Deployment, to update Deployment with a completely new version of the object.
Step9:  Use delete_xxxx command for Deployment, to delete created Deployment.
<ASSISTANT_TASK:>
Python Code:
from kubernetes import client, config
Explanation: Managing kubernetes objects using common resource operations with the python client
Some of these operations include;
create_xxxx : create a resource object. Ex create_namespaced_pod and create_namespaced_deployment, for creation of pods and deployments respectively. This performs operations similar to kubectl create.
read_xxxx : read the specified resource object. Ex read_namespaced_pod and read_namespaced_deployment, to read pods and deployments respectively. This performs operations similar to kubectl describe.
list_xxxx : retrieve all resource objects of a specific type. Ex list_namespaced_pod and list_namespaced_deployment, to list pods and deployments respectively. This performs operations similar to kubectl get.
patch_xxxx : apply a change to a specific field. Ex patch_namespaced_pod and patch_namespaced_deployment, to update pods and deployments respectively. This performs operations similar to kubectl patch, kubectl label, kubectl annotate etc.
replace_xxxx : replacing a resource object will update the resource by replacing the existing spec with the provided one. Ex replace_namespaced_pod and replace_namespaced_deployment, to update pods and deployments respectively, by creating new replacements of the entire object. This performs operations similar to kubectl rolling-update, kubectl apply and kubectl replace.
delete_xxxx : delete a resource. This performs operations similar to kubectl delete.
For Further information see the Documentation for API Endpoints section in https://github.com/kubernetes-client/python/blob/master/kubernetes/README.md
End of explanation
config.load_kube_config()
Explanation: Load config from default location.
End of explanation
api_instance = client.AppsV1Api()
dep = client.V1Deployment()
spec = client.V1DeploymentSpec()
Explanation: Create API endpoint instance as well as API resource instances (body and specification).
End of explanation
name = "my-busybox"
dep.metadata = client.V1ObjectMeta(name=name)
spec.template = client.V1PodTemplateSpec()
spec.template.metadata =  client.V1ObjectMeta(name="busybox")
spec.template.metadata.labels = {"app":"busybox"}
spec.template.spec = client.V1PodSpec()
dep.spec = spec
container = client.V1Container()
container.image = "busybox:1.26.1"
container.args = ["sleep", "3600"]
container.name = name
spec.template.spec.containers = [container]
Explanation: Fill required object fields (apiVersion, kind, metadata and spec).
End of explanation
api_instance.create_namespaced_deployment(namespace="default",body=dep)
Explanation: Create Deployment using create_xxxx command for Deployments.
End of explanation
deps = api_instance.list_namespaced_deployment(namespace="default")
for item in deps.items:
    print("%s  %s" % (item.metadata.namespace, item.metadata.name))
Explanation: Use list_xxxx command for Deployment, to list Deployments.
End of explanation
api_instance.read_namespaced_deployment(namespace="default",name=name)
Explanation: Use read_xxxx command for Deployment, to display the detailed state of the created Deployment resource.
End of explanation
dep.metadata.labels = {"key": "value"}
api_instance.patch_namespaced_deployment(name=name, namespace="default", body=dep)
Explanation: Use patch_xxxx command for Deployment, to make specific update to the Deployment.
End of explanation
dep.spec.template.spec.containers[0].image = "busybox:1.26.2"
api_instance.replace_namespaced_deployment(name=name, namespace="default", body=dep)
Explanation: Use replace_xxxx command for Deployment, to update Deployment with a completely new version of the object.
End of explanation
api_instance.delete_namespaced_deployment(name=name, namespace="default", body=client.V1DeleteOptions(propagation_policy="Foreground", grace_period_seconds=5))
Explanation: Use delete_xxxx command for Deployment, to delete created Deployment.
End of explanation
<END_TASK>