```python
cls = 'md_%s' % tag
elem.attrib['class'] = (elem.attrib['class'] + ' ' + cls if 'class' in elem.attrib else cls)
```