def clean_pod_template(pod_template):
if isinstance(pod_template, str):<EOL><INDENT>msg = ('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>raise TypeError(msg % pod_template)<EOL><DEDENT>if isinstance(pod_template, dict):<EOL><INDENT>msg = ('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>raise TypeError(msg % str(pod_template))<EOL><DEDENT>pod_template = copy.deepcopy(pod_template)<EOL>if pod_template.metadata is None:<EOL><INDENT>pod_template.metadata = client.V1ObjectMeta()<EOL><DEDENT>if pod_template.metadata.labels is None:<EOL><INDENT>pod_template.metadata.labels = {}<EOL><DEDENT>if pod_template.spec.containers[<NUM_LIT:0>].env is None:<EOL><INDENT>pod_template.spec.containers[<NUM_LIT:0>].env = []<EOL><DEDENT>return pod_template<EOL>
Normalize pod template and check for type errors