  def ListPods(self, namespace: Optional[str] = None) -> List['K8sPod']:
    """Lists the pods on this node, possibly filtering for a namespace.

    Args:
      namespace (str): Optional. The namespace in which to list the node's pods.

    Returns:
      List[K8sPod]: The list of the node's pods for the namespace, or in all
          namespaces if none is specified.
    """
    api = self._Api(client.CoreV1Api)

    # The pods must be running, and must be on this node. The selectors here
    # are as per the API calls in `kubectl describe node NODE_NAME`.
    running_on_node_selector = selector.K8sSelector(
        selector.K8sSelector.Node(self.name),
        selector.K8sSelector.Running(),
    )

    if namespace is not None:
      pods = api.list_namespaced_pod(
          namespace, **running_on_node_selector.ToKeywords())
    else:
      pods = api.list_pod_for_all_namespaces(
          **running_on_node_selector.ToKeywords())

    return [
        K8sPod(self._api_client, pod.metadata.name, pod.metadata.namespace)
        for pod in pods.items
    ]
Lists the pods on this node, possibly filtering for a namespace.

Args:
namespace (str): Optional. The namespace in which to list the node's pods.

Returns:
List[K8sPod]: The list of the node's pods for the namespace, or in all
namespaces if none is specified.
libcloudforensics/providers/kubernetes/base.py