def ToCategorizedPath(path_type, components):
  """Translates a path type and a list of components to a categorized path."""
  try:
    prefix = {
        PathInfo.PathType.OS: ("fs", "os"),
        PathInfo.PathType.TSK: ("fs", "tsk"),
        PathInfo.PathType.REGISTRY: ("registry",),
        PathInfo.PathType.TEMP: ("temp",),
    }[path_type]
  except KeyError:
    raise ValueError("Unknown path type: `%s`" % path_type)

  return "/".join(itertools.chain(prefix, components))
Translates a path type and a list of components to a categorized path.