I've noticed that kerberos.getServerPrincipalDetails raises a 'Principal not found in keytab' exception if the FQDN is not used for the 'hostname' argument. I think it would be better to use socket.getfqdn as the default value in init_kerberos instead of socket.gethostname.