def unpack(params):
    """Flatten tuple dict key/value pairs
    e.g.
    assert (
        expand_paired_params([
            ('latent_dim', 2),
            (('a', 'b'), (1, 2)),
            ('lets_overfit', True)
        ])
        == {'latent_dim': 1, 'a': 1, 'b': 2, 'lets_overfit': True},)
    """
    params = params.items() if isinstance(params, dict) else params
    for n, v in params:
        if isinstance(n, tuple):
            for ni, vi in zip(n, v):
                yield ni, vi
        else:
            yield n, v
