import socket


def get_fqdn(_socket=None):
    """
    Return what might be a valid FQDN and avoiding possible
    localhost names
    """
    sock = _socket or socket
    fqdn = sock.getfqdn()
    if fqdn.endswith('.local') or fqdn.startswith('localhost'):
        return None
    return fqdn