# Buggy code
def train(self, training_trackers: List[DialogueStateTracker], **kwargs: Any) -> None:
    """Train the policies / policy ensemble using dialogue data from file.

    Args:
        training_trackers: trackers to train on
        **kwargs: additional arguments passed to the underlying ML
                       trainer (e.g. keras parameters)
    """
    if not self.is_ready():
        raise AgentNotReady("Can't train without a policy ensemble.")

    # deprecation tests
    if kwargs.get("featurizer"):
        raise Exception(
            "Passing `featurizer` "
            "to `agent.train(...)` is not supported anymore. "
            "Pass appropriate featurizer directly "
            "to the policy configuration instead. More info "
            "{}/core/migrations.html".format(LEGACY_DOCS_BASE_URL)
        )
    if kwargs.get("epochs") or kwargs.get("max_history") or kwargs.get("batch_size"):
        raise Exception(
            "Passing policy configuration parameters "
            "to `agent.train(...)` is not supported "
            "anymore. Specify parameters directly in the "
            "policy configuration instead. More info "
            "{}/core/migrations.html".format(LEGACY_DOCS_BASE_URL)
        )

    if isinstance(training_trackers, str):
        # the user most likely passed in a file name to load training
        # data from
        raise Exception(
            "Passing a file name to `agent.train(...)` is "
            "not supported anymore. Rather load the data with "
            "`data = agent.load_data(file_name)` and pass it "
            "to `agent.train(data)`."
        )

    logger.debug("Agent trainer got kwargs: {}".format(kwargs))

    check_domain_sanity(self.domain)

    self.policy_ensemble.train(training_trackers, self.domain, **kwargs)
    self._set_fingerprint()


# Traceback (AttributeError)
Starting Rasa X in local mode... 🚀
Traceback (most recent call last):
File "/.../.venv/bin/rasa", line 12, in <module>
sys.exit(main())
File "/.../.venv/lib/python3.6/site-packages/rasa/__main__.py", line 70, in main
cmdline_arguments.func(cmdline_arguments)
File "/.../.venv/lib/python3.6/site-packages/rasa/cli/x.py", line 243, in rasa_x
local.main(args, project_path, args.data, token=rasa_x_token)
File "/.../.venv/lib/python3.6/site-packages/rasax/community/local.py", line 194, in main
session)
File "/.../.venv/lib/python3.6/site-packages/rasax/community/local.py", line 144, in _initialize_with_local_data
LOCAL_PROJECT_NAME,
File "/.../.venv/lib/python3.6/site-packages/rasax/community/api/initialise.py", line 170, in inject_domain
username=username)
File "/.../.venv/lib/python3.6/site-packages/rasax/community/services/projects_service.py", line 48, in store_domain
templates = _templates(domain, username, project_id)
File "/.../.venv/lib/python3.6/site-packages/rasax/community/services/projects_service.py", line 259, in _templates
for template, responses in templates.items() for response in responses
File "/.../.venv/lib/python3.6/site-packages/rasax/community/services/projects_service.py", line 259, in <listcomp>
for template, responses in templates.items() for response in responses
AttributeError: 'str' object has no attribute 'get'

# Fixed code
def train(self, training_trackers: List[DialogueStateTracker], **kwargs: Any) -> None:
    """Train the policies / policy ensemble using dialogue data from file.

    Args:
        training_trackers: trackers to train on
        **kwargs: additional arguments passed to the underlying ML
                       trainer (e.g. keras parameters)
    """
    if not self.is_ready():
        raise AgentNotReady("Can't train without a policy ensemble.")

    # deprecation tests
    if kwargs.get("featurizer"):
        raise Exception(
            "Passing `featurizer` "
            "to `agent.train(...)` is not supported anymore. "
            "Pass appropriate featurizer directly "
            "to the policy configuration instead. More info "
            "{}/core/migrations.html".format(LEGACY_DOCS_BASE_URL)
        )
    if kwargs.get("epochs") or kwargs.get("max_history") or kwargs.get("batch_size"):
        raise Exception(
            "Passing policy configuration parameters "
            "to `agent.train(...)` is not supported "
            "anymore. Specify parameters directly in the "
            "policy configuration instead. More info "
            "{}/core/migrations.html".format(LEGACY_DOCS_BASE_URL)
        )

    if isinstance(training_trackers, str):
        # the user most likely passed in a file name to load training
        # data from
        raise Exception(
            "Passing a file name to `agent.train(...)` is "
            "not supported anymore. Rather load the data with "
            "`data = agent.load_data(file_name)` and pass it "
            "to `agent.train(data)`."
        )

    logger.debug("Agent trainer got kwargs: {}".format(kwargs))

    self.policy_ensemble.train(training_trackers, self.domain, **kwargs)
    self._set_fingerprint()