def join(s1, s2):
  # type: (str, str) -> str
  """Join pathnames.

  Ignore the previous parts if a part is absolute.  Insert a '/' unless the
  first part is empty or already ends in '/'.

  Special case of os.path.join() which avoids varargs.
  """
  if s2.startswith('/') or len(s1) == 0:
    # absolute path
    return s2

  if s1.endswith('/'):
    return s1 + s2

  return '%s/%s' % (s1, s2)