human
I wrote the below code

    if (not isinstance(nodes, list)):
        raise errors.AnsibleFilterError('failed    expects    to    filter    on    a    list')
    if (not isinstance(label, string_types)):
        raise errors.AnsibleFilterError('failed    expects    label    to    be    a    string')
    if ((value is not None) and (not isinstance(value, string_types))):
        raise errors.AnsibleFilterError('failed    expects    value    to    be    a    string')
    def label_filter(node):
        '    filter    function    for    testing    if    node    should    be    returned    '
        if (not isinstance(node, dict)):
            raise errors.AnsibleFilterError('failed    expects    to    filter    on    a    list    of    dicts')
        if ('openshift_node_labels' in node):
            labels = node['openshift_node_labels']
        elif ('cli_openshift_node_labels' in node):
            labels = node['cli_openshift_node_labels']
        elif (('openshift' in node) and ('node' in node['openshift']) and ('labels' in node['openshift']['node'])):
            labels = node['openshift']['node']['labels']
        else:
            return False
        if isinstance(labels, string_types):
            labels = yaml.safe_load(labels)
        if (not isinstance(labels, dict)):
            raise errors.AnsibleFilterError('failed    expected    node    labels    to    be    a    dict    or    serializable    to    a    dict')
        return ((label in labels) and ((value is None) or (labels[label] == value)))
    return [n for n in nodes if label_filter(n)]

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

def oo_nodes_with_label(nodes, label, value=None):