# Buggy code
def _check_consider_get(self, node):
    def type_and_name_are_equal(node_a, node_b):
        for _type in [astroid.Name, astroid.AssignName]:
            if all(isinstance(_node, _type) for _node in [node_a, node_b]):
                return node_a.name == node_b.name
        if all(isinstance(_node, astroid.Const) for _node in [node_a, node_b]):
            return node_a.value == node_b.value
        return False

    if_block_ok = (
        isinstance(node.test, astroid.Compare)
        and len(node.body) == 1
        and isinstance(node.body[0], astroid.Assign)
        and isinstance(node.body[0].value, astroid.Subscript)
        and type_and_name_are_equal(node.body[0].value.value, node.test.ops[0][1])
        and type_and_name_are_equal(node.body[0].value.slice.value, node.test.left)
        and len(node.body[0].targets) == 1
        and isinstance(node.body[0].targets[0], astroid.AssignName)
        and isinstance(utils.safe_infer(node.test.ops[0][1]), astroid.Dict)
    )

    if if_block_ok and not node.orelse:
        self.add_message("consider-using-get", node=node)
    elif (
        if_block_ok
        and len(node.orelse) == 1
        and isinstance(node.orelse[0], astroid.Assign)
        and type_and_name_are_equal(node.orelse[0].targets[0], node.body[0].targets[0])
        and len(node.orelse[0].targets) == 1
    ):
        self.add_message("consider-using-get", node=node)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user/pylint/pylint/__main__.py", line 7, in <module>
pylint.run_pylint()
File "/home/user/pylint/pylint/__init__.py", line 18, in run_pylint
Run(sys.argv[1:])
File "/home/user/pylint/pylint/lint.py", line 1372, in __init__
linter.check(args)
File "/home/user/pylint/pylint/lint.py", line 784, in check
self._do_check(files_or_modules)
File "/home/user/pylint/pylint/lint.py", line 917, in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
File "/home/user/pylint/pylint/lint.py", line 997, in check_astroid_module
walker.walk(ast_node)
File "/home/user/pylint/pylint/utils.py", line 1152, in walk
self.walk(child)
File "/home/user/pylint/pylint/utils.py", line 1149, in walk
cb(astroid)
File "/home/user/pylint/pylint/checkers/refactoring.py", line 410, in visit_if
self._check_consider_get(node)
File "/home/user/pylint/pylint/checkers/refactoring.py", line 392, in _check_consider_get
and type_and_name_are_equal(node.body[0].value.slice.value, node.test.left)
AttributeError: 'Slice' object has no attribute 'value'

# Fixed code
def _check_consider_get(self, node):
    def type_and_name_are_equal(node_a, node_b):
        for _type in [astroid.Name, astroid.AssignName]:
            if all(isinstance(_node, _type) for _node in [node_a, node_b]):
                return node_a.name == node_b.name
        if all(isinstance(_node, astroid.Const) for _node in [node_a, node_b]):
            return node_a.value == node_b.value
        return False

    if_block_ok = (
        isinstance(node.test, astroid.Compare)
        and len(node.body) == 1
        and isinstance(node.body[0], astroid.Assign)
        and isinstance(node.body[0].value, astroid.Subscript)
        and type_and_name_are_equal(node.body[0].value.value, node.test.ops[0][1])
        and isinstance(node.body[0].value.slice, astroid.Index)
        and type_and_name_are_equal(node.body[0].value.slice.value, node.test.left)
        and len(node.body[0].targets) == 1
        and isinstance(node.body[0].targets[0], astroid.AssignName)
        and isinstance(utils.safe_infer(node.test.ops[0][1]), astroid.Dict)
    )

    if if_block_ok and not node.orelse:
        self.add_message("consider-using-get", node=node)
    elif (
        if_block_ok
        and len(node.orelse) == 1
        and isinstance(node.orelse[0], astroid.Assign)
        and type_and_name_are_equal(node.orelse[0].targets[0], node.body[0].targets[0])
        and len(node.orelse[0].targets) == 1
    ):
        self.add_message("consider-using-get", node=node)