def tar_mode(gzip=None, xz=None, is_pipe=None):
    """Return tarfile.open compatible mode from boolean flags"""
    if gzip:
        return ":gz"
    if xz:
        return ":xz"
    if is_pipe:
        return "|"
    return ""