def generate_host_meta(template=None, *args, **kwargs):
    """Generate a host-meta XRD document.

    Template specific key-value pairs need to be passed as ``kwargs``, see classes.

    :arg template: Ready template to fill with args, for example "diaspora" (optional)
    :returns: Rendered XRD document (str)
    """
    if template == "diaspora":
        hostmeta = DiasporaHostMeta(*args, **kwargs)
    else:
        hostmeta = BaseHostMeta(*args, **kwargs)
    return hostmeta.render()