def get_lib_extension(lib):
    """Return extension of the library

    Takes extensions such as so.1.2.3 into account.

    Args:
      lib: The library File.

    Returns:
      String: extension of the library.
    """
    n = lib.basename.find(".so.")
    end = lib.extension if n == -1 else lib.basename[n + 1:]
    return end