def vfs_construct_path(base_path, *path_components):
 path = base_path
 for component in path_components:
  if component.startswith('/'):
   path = component
  elif ((path == '') or path.endswith('/')):
   path += component
  else:
   path += ('/%s' % component)
 return path

def vfs_construct_path ( base_path , * path_components ) : path = base_path for component in path_components : if component . startswith ( '/' ) : path = component elif ( ( path == '' ) or path . endswith ( '/' ) ) : path += component else : path += ( '/%s' % component ) return path
mimics behavior of os .