'Render functions to LaTeX, handling functions that LaTeX knows about
e.g., sin, cos, ... by using the proper LaTeX command (\sin, \cos, ...).
For single-letter function names, render them as regular LaTeX math
symbols. For multi-letter function names that LaTeX does not know
about, (e.g., Li, sech) use \operatorname{} so that the function name
is rendered in Roman font and LaTeX handles spacing properly.
expr is the expression involving the function
exp is an exponent'

def _print_Function(self, expr, exp=None):

    func = expr.func.__name__
    if hasattr(self, ('_print_' + func)):
        return getattr(self, ('_print_' + func))(expr, exp)
    else:
        args = [str(self._print(arg)) for arg in expr.args]
        inv_trig_style = self._settings['inv_trig_style']
        inv_trig_power_case = False
        can_fold_brackets = (self._settings['fold_func_brackets'] and (len(args) == 1) and (not self._needs_function_brackets(expr.args[0])))
        inv_trig_table = ['asin', 'acos', 'atan', 'acot']
        if (func in inv_trig_table):
            if (inv_trig_style == 'abbreviated'):
                func = func
            elif (inv_trig_style == 'full'):
                func = ('arc' + func[1:])
            elif (inv_trig_style == 'power'):
                func = func[1:]
                inv_trig_power_case = True
                if (exp is not None):
                    can_fold_brackets = False
        if inv_trig_power_case:
            if (func in accepted_latex_functions):
                name = ('\\%s^{-1}' % func)
            else:
                name = ('\\operatorname{%s}^{-1}' % func)
        elif (exp is not None):
            name = ('%s^{%s}' % (self._hprint_Function(func), exp))
        else:
            name = self._hprint_Function(func)
        if can_fold_brackets:
            if (func in accepted_latex_functions):
                name += '    {%s}'
            else:
                name += '%s'
        else:
            name += '{\\left    (%s    \\right    )}'
        if (inv_trig_power_case and (exp is not None)):
            name += ('^{%s}' % exp)
        return (name % ','.join(args))
