def VFSOpen(pathspec, progress_callback=None):
 fd = None
 vroot = VFS_VIRTUALROOTS.get(pathspec.pathtype)
 if ((not vroot) or pathspec.is_virtualroot or pathspec.CollapsePath().startswith(vroot.CollapsePath())):
  working_pathspec = pathspec.Copy()
 else:
  working_pathspec = vroot.Copy()
  working_pathspec.last.nested_path = pathspec.Copy()
 while working_pathspec:
  component = working_pathspec.Pop()
  try:
   handler = VFS_HANDLERS[component.pathtype]
  except KeyError:
   raise IOError(('VFS handler %d not supported.' % component.pathtype))
  try:
   fd = handler.Open(fd, component, pathspec=working_pathspec, full_pathspec=pathspec, progress_callback=progress_callback)
  except IOError as e:
   raise IOError(('%s: %s' % (e, pathspec)))
 return fd

def VFSOpen ( pathspec , progress_callback = None ) : fd = None vroot = VFS_VIRTUALROOTS . get ( pathspec . pathtype ) if ( ( not vroot ) or pathspec . is_virtualroot or pathspec . CollapsePath ( ) . startswith ( vroot . CollapsePath ( ) ) ) : working_pathspec = pathspec . Copy ( ) else : working_pathspec = vroot . Copy ( ) working_pathspec . last . nested_path = pathspec . Copy ( ) while working_pathspec : component = working_pathspec . Pop ( ) try : handler = VFS_HANDLERS [ component . pathtype ] except KeyError : raise IOError ( ( 'VFS handler %d not supported.' % component . pathtype ) ) try : fd = handler . Open ( fd , component , pathspec = working_pathspec , full_pathspec = pathspec , progress_callback = progress_callback ) except IOError as e : raise IOError ( ( '%s: %s' % ( e , pathspec ) ) ) return fd
expands pathspec to return an expanded path .