def activate_text(shell: dict, env_vars: dict, cat=False) -> str:
    """Returns the formatted text to write to the activation script
    based on the passed dictionaries."""

    lines = [shell["shebang"]]
    for k, v in env_vars.items():
        lines.append(shell["activate"].format(k, v))

    if shell["activate_extra"] != "":
        lines.append(shell["activate_extra"])

    if cat:
        lines.append("cat $ISISROOT/version")

    return "\n".join(lines)