def set_attr(self, attr_name: str, attr_value: str) -> None:
<EOL>cell_match = self._match<EOL>shadow = cell_match.string<EOL>attrs_start, attrs_end = cell_match.span('<STR_LIT>')<EOL>if attrs_start != -<NUM_LIT:1>:<EOL><INDENT>encoded_attr_name = attr_name.encode()<EOL>attrs_m = ATTRS_MATCH(shadow, attrs_start, attrs_end)<EOL>for i, n in enumerate(reversed(attrs_m.captures('<STR_LIT>'))):<EOL><INDENT>if n == encoded_attr_name:<EOL><INDENT>vs, ve = attrs_m.spans('<STR_LIT>')[-i - <NUM_LIT:1>]<EOL>q = <NUM_LIT:1> if attrs_m.string[ve] in b'<STR_LIT>' else <NUM_LIT:0><EOL>self[vs - q:ve + q] = '<STR_LIT>'.format(attr_value)<EOL>return<EOL><DEDENT><DEDENT>attr_end = cell_match.end('<STR_LIT>')<EOL>fmt = '<STR_LIT>' if shadow[attr_end - <NUM_LIT:1>] == <NUM_LIT:32> else '<STR_LIT>'<EOL>self.insert(attr_end, fmt.format(attr_name, attr_value))<EOL>return<EOL><DEDENT>fmt = '<STR_LIT>' if attr_value else '<STR_LIT>'<EOL>if shadow[<NUM_LIT:0>] == <NUM_LIT:10>:  <EOL><INDENT>self.insert(<EOL>cell_match.start('<STR_LIT>') + <NUM_LIT:1>,<EOL>fmt.format(attr_name, attr_value)<EOL>)<EOL>return<EOL><DEDENT>self.insert(<NUM_LIT:2>, fmt.format(attr_name, attr_value))<EOL>return<EOL>
Set the value for the given attribute name.

        If there are already multiple attributes with that name, only
        set the value for the last one.
        If attr_value == '', use the implicit empty attribute syntax.