def safe_join(directory, *pathnames):
 for filename in pathnames:
  if (filename != ''):
   filename = posixpath.normpath(filename)
  for sep in _os_alt_seps:
   if (sep in filename):
    raise NotFound()
  if (os.path.isabs(filename) or (filename == '..') or filename.startswith('../')):
   raise NotFound()
  directory = os.path.join(directory, filename)
 return directory

def safe_join ( directory , * pathnames ) : for filename in pathnames : if ( filename != '' ) : filename = posixpath . normpath ( filename ) for sep in _os_alt_seps : if ( sep in filename ) : raise NotFound ( ) if ( os . path . isabs ( filename ) or ( filename == '..' ) or filename . startswith ( '../' ) ) : raise NotFound ( ) directory = os . path . join ( directory , filename ) return directory
safely join directory and filename .