human
I wrote the below code

    def truncate_hostname(name):
        if (len(name) > 63):
            LOG.warning(_LW('Hostname    %(hostname)s    is    longer    than    63,    truncate    it    to    %(truncated_name)s'), {'hostname': name, 'truncated_name': name[:63]})
        return name[:63]
    if isinstance(hostname, six.text_type):
        hostname = hostname.encode('latin-1', 'ignore')
        if six.PY3:
            hostname = hostname.decode('latin-1')
    hostname = truncate_hostname(hostname)
    hostname = re.sub('[    _]', '-', hostname)
    hostname = re.sub('[^\\w.-]+', '', hostname)
    hostname = hostname.lower()
    hostname = hostname.strip('.-')
    if ((hostname == '') and (default_name is not None)):
        return truncate_hostname(default_name)
    return hostname

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def sanitize_hostname(hostname, default_name=None):