def get_attr(attr_list, global_attrs):
local_attr = [], {}<EOL>for kv in attr_list:<EOL><INDENT>keyword = kv[<NUM_LIT:0>]<EOL>if len(kv) == <NUM_LIT:1>:<EOL><INDENT>local_attr[<NUM_LIT:0>].append(keyword)<EOL>continue<EOL><DEDENT>elif len(kv) == <NUM_LIT:2>:<EOL><INDENT>value = kv[<NUM_LIT:1>]<EOL><DEDENT>elif len(kv) > <NUM_LIT:2>:<EOL><INDENT>value = kv[<NUM_LIT:1>:]<EOL><DEDENT>if keyword == '<STR_LIT>':<EOL><INDENT>local_attr[<NUM_LIT:1>].setdefault(keyword, set()).add(value)<EOL><DEDENT>else:<EOL><INDENT>local_attr[<NUM_LIT:1>][keyword] = value<EOL><DEDENT><DEDENT>attr0 = copy.copy(global_attrs[<NUM_LIT:0>])<EOL>attr1 = copy.copy(global_attrs[<NUM_LIT:1>])<EOL>if local_attr[<NUM_LIT:0>]:<EOL><INDENT>attr0.extend(local_attr[<NUM_LIT:0>])<EOL><DEDENT>if local_attr[<NUM_LIT:1>]:<EOL><INDENT>attr1.update(local_attr[<NUM_LIT:1>])<EOL><DEDENT>return attr0, attr1<EOL>
Parameters
----------
attr_list : list
    A list of (keyword, value) tuple pairs
global_attrs : tuple(list, dict)
    Global attributes which update the local attributes