<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def max_line_ext(network, snapshots, share=1.01):
 """ Sets maximal share of overall network extension as extra functionality in LOPF Parameters share: float Maximal share of network extension in p.u. """


    lines_snom = network.lines.s_nom.sum()
    links_pnom = network.links.p_nom.sum()

    def _rule(m):

        lines_opt = sum(m.passive_branch_s_nom[index]
                        for index
                        in m.passive_branch_s_nom_index)

        links_opt = sum(m.link_p_nom[index]
                        for index
                        in m.link_p_nom_index)

        return (lines_opt + links_opt) <= (lines_snom + links_pnom) * share
    network.model.max_line_ext = Constraint(rule=_rule)