def _drop_external(path):
  """Drop leading '../' indicating an external dir of the form ../$some-repo.

  Non-generated external protos show up in a parallel directory.
  e.g. ptypes/any/any.proto is at ../com_github_golang_protobuf/ptypes/any/any.proto
  So this function detects and drops the 2 leading directories in this case.

  Args:
    path: short_path of a proto file

  Returns:
    A cleaned path.
  """
  if not path.startswith("../"):
    return path
  return "/".join(path.split("/")[2:])