human
Complete this python program:
def function_closure(functions, casify):
assistant
#Here is the Python program you requested.

    """Wrap `render_function` so it knows the functions allowed.
    """
    def render_function(children):
        "\n                                Escape    function    names    and    give    proper    formatting    to    exceptions.\n\n                                The    exceptions    being    'sqrt',    'log2',    and    'log10'    as    of    now.\n                                "
        fname = children[0].latex
        if (casify(fname) not in functions):
            pass
        inner = children[1].latex
        if (fname == 'sqrt'):
            inner = u'{{{expr}}}'.format(expr=inner)
        elif children[1].tall:
            inner = u'\\left({expr}\\right)'.format(expr=inner)
        else:
            inner = u'({expr})'.format(expr=inner)
        if (fname == 'sqrt'):
            fname = u'\\sqrt'
        elif (fname == 'log10'):
            fname = u'\\log_{10}'
        elif (fname == 'log2'):
            fname = u'\\log_2'
        else:
            fname = u'\\text{{{fname}}}'.format(fname=fname)
        latex = (fname + inner)
        return LatexRendered(latex, tall=children[1].tall)
    return render_function