def find_sockdir():
 for dir in SEARCH_DIRS:
  for (dirpath, dirnames, dirfiles) in os.walk(dir, followlinks=True):
   for name in dirfiles:
    if (utils.is_sockfile(os.path.join(dirpath, name)) and ('PGSQL' in name)):
     return dirpath

def find_sockdir ( ) : for dir in SEARCH_DIRS : for ( dirpath , dirnames , dirfiles ) in os . walk ( dir , followlinks = True ) : for name in dirfiles : if ( utils . is_sockfile ( os . path . join ( dirpath , name ) ) and ( 'PGSQL' in name ) ) : return dirpath
returns a path to postgresql socket file to monitor .