def _get_aggtmp_basedir(ds, mkdir=False):
    """Return a pathlib Path for a temp directory to put aggregated metadata"""
    tmp_basedir = ds.pathobj / '.git' / 'tmp' / 'aggregate-metadata'
    if mkdir:
        tmp_basedir.mkdir(parents=True, exist_ok=True)
    return tmp_basedir
