TLD checks for common names and dnsnames.

As in title. There is small ugly part that TLD check for common name and dnsname looks pretty much the same, but I wasn't sure where I could extract it. I'm also not sure if my approach to checking whether a name is probably an address or not is correct (I'm converting name to idna and checking whether it contains [a-z0-9-.*] characters). I could add this python package: https://pypi.python.org/pypi/rfc3987, so it will be more advanced.   
So, certificates are not actually supposed to have common names anymore (at least, not as their domain name), so these tests seem a bit misguided:

a) You need to also check all the SANs.

b) Presence of a CN should probably be viewed as an error.

c) _If_ there's a CN, then it should be checked for TLD matches.