import lzma
import gzip


def get_open_function(path):
    """Choose an open function based on the file's extension."""
    if path.endswith('xz'):
        return lzma.open
    elif path.endswith('gz'):
        return gzip.open
    return open