human
I wrote the below code

    if (not isinstance(target_units, (collections.Iterable, Tuple))):
        target_units = [target_units]
    if isinstance(expr, Add):
        return Add.fromiter((convert_to(i, target_units) for i in expr.args))
    expr = sympify(expr)
    if ((not isinstance(expr, Quantity)) and expr.has(Quantity)):
        expr = expr.replace((lambda x: isinstance(x, Quantity)), (lambda x: x.convert_to(target_units)))
    def get_total_scale_factor(expr):
        if isinstance(expr, Mul):
            return reduce((lambda x, y: (x * y)), [get_total_scale_factor(i) for i in expr.args])
        elif isinstance(expr, Pow):
            return (get_total_scale_factor(expr.base) ** expr.exp)
        elif isinstance(expr, Quantity):
            return expr.scale_factor
        return expr
    depmat = _get_conversion_matrix_for_expr(expr, target_units)
    if (depmat is None):
        return expr
    expr_scale_factor = get_total_scale_factor(expr)
    return (expr_scale_factor * Mul.fromiter(((((1 / get_total_scale_factor(u)) * u) ** p) for (u, p) in zip(target_units, depmat))))

What's a good function header?

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

def convert_to(expr, target_units):