def StripSo(name):
  """Strip trailing hexidecimal characters from the name of a shared object.

  It strips everything after the last '.' in the name, and checks that the new
  name ends with .so.

  e.g.

  libc.so.ad6acbfa => libc.so
  foo.bar.baz => foo.bar.baz
  """
  stripped_name = '.'.join(name.split('.')[:-1])
  if stripped_name.endswith('.so'):
    return stripped_name
  return name