def _detemplate_cell(value, template):
    """Convert a "$" containing template chunk

    Parameters
    ----------
    value : str
        The value to use for "$"
    template: any
        Template or part of a template that needs expanding.

    Returns
    -------
    any
        returns a detemplated version of the input template.
    """
    if isinstance(template, str):
        if template == "$":
            return value
        return template
    if isinstance(template, list):
        rval = []
        for entry in template:
            rval.append(_detemplate_cell(value, entry))
        return rval
    if isinstance(template, dict):
        rval2 = {}
        for key in template.keys():
            rval2[key] = _detemplate_cell(value, template[key])
        return rval2
    return template