def convert_resolv_conf(nameservers, searchdomains):
    """Returns a string formatted for resolv.conf."""
    result = []
    if nameservers:
        nslist = "DNS="
        for ns in nameservers:
            nslist = nslist + '%s ' % ns
        nslist = nslist + '\n'
        result.append(str(nslist))
    if searchdomains:
        sdlist = "Domains="
        for sd in searchdomains:
            sdlist = sdlist + '%s ' % sd
        sdlist = sdlist + '\n'
        result.append(str(sdlist))
    return result