human
I wrote the below code

    def scope_cmp(a, b):
        '\n                                Given    two    addresses,    returns    -1,    0    or    1    based    on    comparison    of\n                                their    scope\n                                '
        scope_mapper = {IPV6_ADDR_GLOBAL: 4, IPV6_ADDR_SITELOCAL: 3, IPV6_ADDR_LINKLOCAL: 2, IPV6_ADDR_LOOPBACK: 1}
        sa = in6_getscope(a)
        if (sa == (-1)):
            sa = IPV6_ADDR_LOOPBACK
        sb = in6_getscope(b)
        if (sb == (-1)):
            sb = IPV6_ADDR_LOOPBACK
        sa = scope_mapper[sa]
        sb = scope_mapper[sb]
        if (sa == sb):
            return 0
        if (sa > sb):
            return 1
        return (-1)
    def rfc3484_cmp(source_a, source_b):
        '\n                                The    function    implements    a    limited    version    of    the    rules    from    Source\n                                Address    selection    algorithm    defined    section    of    RFC    3484.\n                                '
        if (source_a == dst):
            return 1
        if (source_b == dst):
            return 1
        tmp = scope_cmp(source_a, source_b)
        if (tmp == (-1)):
            if (scope_cmp(source_a, dst) == (-1)):
                return 1
            else:
                return (-1)
        elif (tmp == 1):
            if (scope_cmp(source_b, dst) == (-1)):
                return 1
            else:
                return (-1)
        tmp1 = in6_get_common_plen(source_a, dst)
        tmp2 = in6_get_common_plen(source_b, dst)
        if (tmp1 > tmp2):
            return 1
        elif (tmp2 > tmp1):
            return (-1)
        return 0
    if (not candidate_set):
        return None
    candidate_set.sort(cmp=rfc3484_cmp, reverse=True)
    return candidate_set[0]

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

def get_source_addr_from_candidate_set(dst, candidate_set):