def build_attrs(self, *args, **kwargs):
attrs = super(Select2Mixin, self).build_attrs(*args, **kwargs)<EOL>if self.is_required:<EOL><INDENT>attrs.setdefault('<STR_LIT>', '<STR_LIT:false>')<EOL><DEDENT>else:<EOL><INDENT>attrs.setdefault('<STR_LIT>', '<STR_LIT:true>')<EOL>attrs.setdefault('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>attrs.setdefault('<STR_LIT>', <NUM_LIT:0>)<EOL>if '<STR_LIT:class>' in attrs:<EOL><INDENT>attrs['<STR_LIT:class>'] += '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>attrs['<STR_LIT:class>'] = '<STR_LIT>'<EOL><DEDENT>return attrs<EOL>
Add select2 data attributes.