human
Here's a good function header given the following:
I wrote the below code

    JSON_TYPES = {'false': False, 'null': None, 'true': True}
    SAFE_NODES = set((ast.Add, ast.BinOp, ast.Compare, ast.Dict, ast.Div, ast.Expression, ast.List, ast.Load, ast.Mult, ast.Num, ast.Name, ast.Str, ast.Sub, ast.USub, ast.Tuple, ast.UnaryOp))
    if (sys.version_info[:2] >= (2, 7)):
        SAFE_NODES.update(set((ast.Set,)))
    if (sys.version_info[:2] >= (3, 4)):
        SAFE_NODES.update(set((ast.NameConstant,)))
    filter_list = []
    for filter in filter_loader.all():
        filter_list.extend(filter.filters().keys())
    test_list = []
    for test in test_loader.all():
        test_list.extend(test.tests().keys())
    CALL_WHITELIST = ((C.DEFAULT_CALLABLE_WHITELIST + filter_list) + test_list)
    class CleansingNodeVisitor(ast.NodeVisitor, ):
        def generic_visit(self, node, inside_call=False):
            if (type(node) not in SAFE_NODES):
                raise Exception(('invalid    expression    (%s)' % expr))
            elif isinstance(node, ast.Call):
                inside_call = True
            elif (isinstance(node, ast.Name) and inside_call):
                if (hasattr(builtins, node.id) and (node.id not in CALL_WHITELIST)):
                    raise Exception(('invalid    function:    %s' % node.id))
            for child_node in ast.iter_child_nodes(node):
                self.generic_visit(child_node, inside_call)
    if (not isinstance(expr, string_types)):
        if include_exceptions:
            return (expr, None)
        return expr
    cnv = CleansingNodeVisitor()
    try:
        parsed_tree = ast.parse(expr, mode='eval')
        cnv.visit(parsed_tree)
        compiled = compile(parsed_tree, expr, 'eval')
        result = eval(compiled, JSON_TYPES, dict(locals))
        if include_exceptions:
            return (result, None)
        else:
            return result
    except SyntaxError as e:
        if include_exceptions:
            return (expr, None)
        return expr
    except Exception as e:
        if include_exceptions:
            return (expr,...

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

def safe_eval(expr, locals={}, include_exceptions=False):