def _cleanup_pods(namespace, labels):
api = kubernetes.client.CoreV1Api()<EOL>pods = api.list_namespaced_pod(namespace, label_selector=format_labels(labels))<EOL>for pod in pods.items:<EOL><INDENT>try:<EOL><INDENT>api.delete_namespaced_pod(pod.metadata.name, namespace)<EOL>logger.info('<STR_LIT>', pod.metadata.name)<EOL><DEDENT>except kubernetes.client.rest.ApiException as e:<EOL><INDENT>if e.status != <NUM_LIT>:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>
Remove all pods with these labels in this namespace