def gen_repr(cls, template, *args, **kwargs):
buf = io.StringIO()<EOL>buf.write(u'<STR_LIT:<>')<EOL>buf.write(cls.__module__.decode() if kwargs.pop('<STR_LIT>', False) else u'<STR_LIT>')<EOL>buf.write(u'<STR_LIT:.>')<EOL>buf.write(cls.__name__.decode())<EOL>if not kwargs.pop('<STR_LIT>', False):<EOL><INDENT>buf.write(u'<STR_LIT:U+0020>')<EOL><DEDENT>buf.write(template.format(*args, **kwargs))<EOL>options = kwargs.pop('<STR_LIT>', [])<EOL>for attr, value in options:<EOL><INDENT>if value is not None:<EOL><INDENT>buf.write(u'<STR_LIT>' % (attr, value))<EOL><DEDENT><DEDENT>buf.write(u'<STR_LIT:>>')<EOL>return buf.getvalue()<EOL>
Generates a string for :func:`repr`.