# Buggy code
def split_action(arguments):
    class SplitAction(argparse.Action):  # pylint: disable=too-few-public-methods
        def __call__(self, parser, namespace, values, option_string=None):
            """The SplitAction will take the given ID parameter and spread the parsed
            parts of the id into the individual backing fields.

            Since the id value is expected to be of type `IterateValue`, all the backing
            (dest) fields will also be of type `IterateValue`
            """
            try:
                for value in [values] if isinstance(values, str) else values:
                    parts = parse_resource_id(value)
                    for arg in [arg for arg in arguments.values() if arg.id_part]:
                        existing_values = getattr(namespace, arg.name, None)
                        if existing_values is None:
                            existing_values = IterateValue()
                        existing_values.append(parts[arg.id_part])
                        setattr(namespace, arg.name, existing_values)
            except Exception as ex:
                raise ValueError(ex)

    return SplitAction


# Traceback (AttributeError)
'str' object has no attribute 'append'
Traceback (most recent call last):
File "c:\users\trpresco\documents\github\azure-cli\src\azure\cli\commands\arm.py", line 110, in __call__
existing_values.append(parts[arg.id_part])
AttributeError: 'str' object has no attribute 'append'

# Fixed code
def split_action(arguments):
    class SplitAction(argparse.Action):  # pylint: disable=too-few-public-methods
        def __call__(self, parser, namespace, values, option_string=None):
            """The SplitAction will take the given ID parameter and spread the parsed
            parts of the id into the individual backing fields.

            Since the id value is expected to be of type `IterateValue`, all the backing
            (dest) fields will also be of type `IterateValue`
            """
            try:
                for value in [values] if isinstance(values, str) else values:
                    parts = parse_resource_id(value)
                    for arg in [arg for arg in arguments.values() if arg.id_part]:
                        existing_values = getattr(namespace, arg.name, None)
                        if existing_values is None:
                            existing_values = IterateValue()
                            existing_values.append(parts[arg.id_part])
                        elif isinstance(existing_values, str):
                            logger.warning(
                                "Property '%s=%s' being overriden by value '%s' from IDs parameter.",  # pylint: disable=line-too-long
                                arg.name,
                                existing_values,
                                parts[arg.id_part],
                            )
                            existing_values = IterateValue()
                            existing_values.append(parts[arg.id_part])
                        setattr(namespace, arg.name, existing_values)
            except Exception as ex:
                raise ValueError(ex)

    return SplitAction