'Convert an API response to a Pod object'

def _to_pod(self, data):

    container_statuses = data['status']['containerStatuses']
    containers = []
    for container in data['spec']['containers']:
        spec = list(filter((lambda i: (i['name'] == container['name'])), container_statuses))[0]
        containers.append(self._to_container(container, spec, data))
    return KubernetesPod(name=data['metadata']['name'], namespace=data['metadata']['namespace'], containers=containers)
