def _genXML(metadata, metaopts):
    """Use the option name as a tag name to wrap the data."""
    xml = ''
    for metaopt in metaopts:
        value = metadata.get(metaopt)
        if not value:
            value = 'unavailable'
        xml += '<%s>' % metaopt
        xml += str(value)
        xml += '</%s>\n' % metaopt
    return xml
