def domain_to_basedn(domain):
    """
    Convert a domain (example.com) to base DN (dc=example,dc=com)
    """
    dn = []
    for part in domain.lower().split('.'):
        dn.append("dc=%s" % (part))

    return ','.join(dn)