def dn_startswith(descendant_dn, dn):
 if (not isinstance(descendant_dn, list)):
  descendant_dn = ldap.dn.str2dn(utf8_encode(descendant_dn))
 if (not isinstance(dn, list)):
  dn = ldap.dn.str2dn(utf8_encode(dn))
 if (len(descendant_dn) <= len(dn)):
  return False
 return is_dn_equal(descendant_dn[(- len(dn)):], dn)

def dn_startswith ( descendant_dn , dn ) : if ( not isinstance ( descendant_dn , list ) ) : descendant_dn = ldap . dn . str2dn ( utf8_encode ( descendant_dn ) ) if ( not isinstance ( dn , list ) ) : dn = ldap . dn . str2dn ( utf8_encode ( dn ) ) if ( len ( descendant_dn ) <= len ( dn ) ) : return False return is_dn_equal ( descendant_dn [ ( - len ( dn ) ) : ] , dn )
return true if and only if the descendant_dn is under the dn .