parameters: (kind, _pid=-1)
return_statement: return list(ret)
docstring: Return socket connections.  If pid == -1 return system-wide
      connections (as opposed to connections opened by one process only).
docstring_summary: Return socket connections.  If pid == -1 return system-wide
      connections (as opposed to connections opened by one process only).
docstring_tokens: Return socket connections . If pid == - 1 return system - wide connections ( as opposed to connections opened by one process only ) .
function: def net_connections(kind, _pid=-1):
      """Return socket connections.  If pid == -1 return system-wide
      connections (as opposed to connections opened by one process only).
      """
      if kind not in conn_tmap:
          raise ValueError("invalid %r kind argument; choose between %s"
                           % (kind, ', '.join([repr(x) for x in conn_tmap])))
      families, types = conn_tmap[kind]
      rawlist = cext.net_connections(_pid, families, types)
      ret = set()
      for item in rawlist:
          fd, fam, type, laddr, raddr, status, pid = item
          nt = conn_to_ntuple(fd, fam, type, laddr, raddr, status, TCP_STATUSES,
                              pid=pid if _pid == -1 else None)
          ret.add(nt)
      return list(ret)
function_tokens: def net_connections ( kind , _pid = - 1 ) : if kind not in conn_tmap : raise ValueError ( "invalid %r kind argument; choose between %s" % ( kind , ', ' . join ( [ repr ( x ) for x in conn_tmap ] ) ) ) families , types = conn_tmap [ kind ] rawlist = cext . net_connections ( _pid , families , types ) ret = set ( ) for item in rawlist : fd , fam , type , laddr , raddr , status , pid = item nt = conn_to_ntuple ( fd , fam , type , laddr , raddr , status , TCP_STATUSES , pid = pid if _pid == - 1 else None ) ret . add ( nt ) return list ( ret )