def format_datastore(datastore_template, run_config):
    """
    Format datastore path based on `run_config` (aka "tagging").

    It is almost equivalent to ``datastore_template.format(**run_config)``
    except that it introduces a new keyword ``layers_str`` based on the
    ``layers`` (list) keyword in `run_config`.

    >>> format_datastore(
    ...     'alpha={alpha}_L={layers_str}',
    ...     dict(alpha=10, layers=[128, 64]))
    'alpha=10_L=128_64'

    """
    return datastore_template.format(
        layers_str='_'.join(map(str, run_config.get('layers', []))),
        **run_config)