def _AlternateFilePath(path, alt_dir, input_api):
  """Return a path with the same basename as |path| but in |alt_dir| directory.

  This is useful for finding corresponding static and generated docs.

  Example:
    _AlternateFilePath('/foo/bar', '/alt/dir', ...) == '/alt/dir/bar')
  """
  base_name = input_api.os_path.basename(path)
  return input_api.os_path.join(alt_dir, base_name)