human
Complete this python program:
def _normalizeHostname(domain):
assistant
#Here is the Python code you requested.

    """Normalizes the given domain, component by component.  ASCII components are
    lowercased, while non-ASCII components are processed using the ToASCII
    algorithm.
    """
    def convertLabel(label):
        if _isASCII(label):
            return label.lower()
        return encodings.idna.ToASCII(label)
    return '.'.join(map(convertLabel, domain.split('.')))