code: def net_connections():
      """Cross-platform psutil.net_connections like interface"""
      if sys.platform.lower().startswith("linux"):
          return psutil.net_connections()
  
      all_connections = []
      Pconn = None
      for p in psutil.process_iter(["pid"]):
          try:
              process = psutil.Process(p.pid)
              connections = process.connections()
              if connections:
                  for conn in connections:
                      # Adding pid to the returned instance
                      # for consistency with psutil.net_connections()
                      if Pconn is None:
                          fields = list(conn._fields)
                          fields.append("pid")
                          _conn = namedtuple("Pconn", fields)
                      for attr in conn._fields:
                          setattr(_conn, attr, getattr(conn, attr))
                      _conn.pid = p.pid
                      all_connections.append(_conn)
  
          except (
              psutil.AccessDenied,
              psutil.ZombieProcess,
              psutil.NoSuchProcess,
          ):
              pass
      return all_connections
  
file_path: mindsdb/tests/integration_tests/flows/ps.py
imports: import sys
  import time
  from collections import namedtuple
  import psutil
label_desc: Use image node_id 1 for calling a global function with example usage: net_connections() and returns: all_connections, psutil