# Buggy code
def get_item_name_and_attributes(self, item, attributes):
    if isinstance(item, ast.Name):
        return item.id, attributes
    elif isinstance(item, ast.AnnAssign):
        return self.get_item_name_and_attributes(item.annotation, attributes)
    elif isinstance(item, ast.Subscript):
        return self.get_item_name_and_attributes(item.value, attributes)
    elif isinstance(item, ast.Call) and item.func.id == "map":
        if len(item.args) != 2:
            raise StructureException(
                "Map type expects two type arguments map(type1, type2)", item.func
            )
        return self.get_item_name_and_attributes(item.args, attributes)
    # elif ist
    elif isinstance(item, ast.Call):
        attributes[item.func.id] = True
        # Raise for multiple args
        if len(item.args) != 1:
            raise StructureException("%s expects one arg (the type)" % item.func.id)
        return self.get_item_name_and_attributes(item.args[0], attributes)
    return None, attributes


# Traceback (AttributeError)
Error compiling:  5.txt
Traceback (most recent call last):
File "/Users/mate/ethermat/security/vyper-fuzz/venv/bin/vyper", line 4, in <module>
__import__('pkg_resources').run_script('vyper==0.1.0b6', 'vyper')
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/pkg_resources/__init__.py", line 658, in run_script
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/setuptools-39.1.0-py3.6.egg/pkg_resources/__init__.py", line 1445, in run_script
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/EGG-INFO/scripts/vyper", line 85, in <module>
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/vyper/compiler.py", line 108, in compile_codes
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/EGG-INFO/scripts/vyper", line 51, in exc_handler
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/vyper/compiler.py", line 105, in compile_codes
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/vyper/compiler.py", line 87, in <lambda>
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/vyper/compiler.py", line 8, in __compile
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/vyper/parser/parser.py", line 229, in parse_tree_to_lll
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/vyper/parser/global_context.py", line 75, in get_global_context
File "/Users/mate/ethermat/security/vyper-fuzz/venv/lib/python3.6/site-packages/vyper-0.1.0b6-py3.6.egg/vyper/parser/global_context.py", line 234, in add_globals_and_events
AttributeError: 'Attribute' object has no attribute 'id'

# Fixed code
def get_item_name_and_attributes(self, item, attributes):
    if isinstance(item, ast.Name):
        return item.id, attributes
    elif isinstance(item, ast.AnnAssign):
        return self.get_item_name_and_attributes(item.annotation, attributes)
    elif isinstance(item, ast.Subscript):
        return self.get_item_name_and_attributes(item.value, attributes)
    elif (
        isinstance(item, ast.Call)
        and isinstance(item.func, ast.Name)
        and item.func.id == "map"
    ):
        if len(item.args) != 2:
            raise StructureException(
                "Map type expects two type arguments map(type1, type2)", item.func
            )
        return self.get_item_name_and_attributes(item.args, attributes)
    # elif ist
    elif isinstance(item, ast.Call) and isinstance(item.func, ast.Name):
        attributes[item.func.id] = True
        # Raise for multiple args
        if len(item.args) != 1:
            raise StructureException("%s expects one arg (the type)" % item.func.id)
        return self.get_item_name_and_attributes(item.args[0], attributes)
    return None, attributes