def user(pid):
 if ((not isinstance(pid, int)) or (pid < 0)):
  return None
 if stem.util.proc.is_available():
  try:
   import pwd
   uid = stem.util.proc.uid(pid)
   if (uid and uid.isdigit()):
    return pwd.getpwuid(int(uid)).pw_name
  except:
   pass
 if is_available('ps'):
  results = call(('ps -o user %s' % pid), [])
  if (len(results) >= 2):
   return results[1].strip()
 return None

def user ( pid ) : if ( ( not isinstance ( pid , int ) ) or ( pid < 0 ) ) : return None if stem . util . proc . is_available ( ) : try : import pwd uid = stem . util . proc . uid ( pid ) if ( uid and uid . isdigit ( ) ) : return pwd . getpwuid ( int ( uid ) ) . pw_name except : pass if is_available ( 'ps' ) : results = call ( ( 'ps -o user %s' % pid ) , [ ] ) if ( len ( results ) >= 2 ) : return results [ 1 ] . strip ( ) return None
require the existence of a postgresql user .