human
I wrote the below code

    if (name == '*'):
        name = (name + ('\x00' * 15))
    elif (len(name) > 15):
        name = (name[:15] + chr(type))
    else:
        name = (string.ljust(name, 15) + chr(type))
    def _do_first_level_encoding(m):
        s = ord(m.group(0))
        return (string.uppercase[(s >> 4)] + string.uppercase[(s & 15)])
    encoded_name = (chr((len(name) * 2)) + re.sub('.', _do_first_level_encoding, name))
    if scope:
        encoded_scope = ''
        for s in string.split(scope, '.'):
            encoded_scope = ((encoded_scope + chr(len(s))) + s)
        return ((encoded_name + encoded_scope) + '\x00')
    else:
        return (encoded_name + '\x00')

What's a good function header?

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

def encode_name(name, type, scope=None):