def force_readable_domain_name(s):
    """
    Converts punycode hostname to human-readable name.
    """
    if s is None:
        return s
    s = s.lower().strip()
    if s.startswith('xn--') or '.xn--' in s:
        try:
            s = s.encode()
            return s.decode('idna')
        except UnicodeError:
            return s
    else:
        return s
