def _get_extension(path):
    """Gets the extension of a path.

    Assumes all extensions except ``.tar.gz`` and ``.tar.bz2`` are single
    extensions.

    Parameters
    ----------
    path: pathlib.Path
        Path to file.

    Returns
    -------
    str:
        File extension.
    """
    known_double_extensions = ['.tar.gz', '.tar.bz2']
    # If extension is not a known double extension, take last part only.
    extensions = ''.join(path.suffixes)
    if extensions in known_double_extensions:
        ext = extensions
    else:
        ext = path.suffixes[-1]
    return ext