## 1 Introduction  
With the ambition of achieving a net-zero greenhouse gas emissions by 2050, European Union planned several actions aimed at realizing high shares of renewable energy use (28% by 2030 and 66% by 2050) and of heat and transport electrification (exceeding 50% by 2050) [1, 2]. Despite the COVID-19 pandemic has caused a fall in electricity consumption [3], the power generation from renewable energy sources (RES) continues its accelerating expansion [4], keeping valid the general goal of increasing loading and hosting capacity of the electric distribution systems. Indeed, a massive production from RES, often non-homothetic with electric demand, and the expected peak load increment due to the electrification of end uses will impact the distribution system operation by worsening voltage profiles and stressing cables and transformers. It is worth noting that this scenario will strongly affect also the bulk power system that needs stable generation support, increasing reserves and ramping services for compensating the decommissioning of polluting conventional generation, consequence of the RES development [5]. Flexibility is the backbone of the electricity system and the current transition of its availability from conventional large power plants to Distributed Energy Resources (DERs) will introduce new challenges to be faced [6]. Undeniably, DERs could support grid operation, selling their flexibility through the participation in wholesale markets [7], but by so doing they may cause technical issues into the distribution system. Therefore, suitable coordination procedures should be implemented between Transmission and DistributionSystem Operators (TSO and DSO), always considering the option for the DSO to exploit part of the flexibility from DERs for the secure operation of their local networks. Indeed, the alternative of an oversized distribution system that enables TSO the unilateral and unrestricted use of this flexibility could be economically unsustainable. In addition, recent EU directives 2019/944 (art. 32) [8] has stated that \"network development plan shall also include the use of demand response, energy efficiency, energy storage facilities or other resources that distribution system operator is to use as an alternative to system expansion\", legitimating the exploitation of flexibility services from DERs as a planning solution for the future Smart Distribution Network (SDN), as anticipated by the scientific community [9; 10; 11]. Flexibility can be defined as the capability of a coordinated multitude of actors to change their behaviour for providing support to the bulk power system operation or to the distribution system management. It comes from the users of the distribution network (loads, generators, stationary storage devices), from sector coupling (electric vehicles, electric boilers, heat pumps and electrolysers for hydrogen production) or from the network itself (network reconfiguration, online tap changer of secondary substations, line voltage regulators). More specifically for the flexibility from DERs, flexible loads may shift in time or curtail (increase) their electricity consumption when participating to Demand Response (DR) programs, flexible generators can curtail (photovoltaic or wind) or shift in time (CHP) their electricity production, and flexible storage may behave like a flexible load or a flexible generator depending on system needs. As aforementioned, modern DSO needs to consider these flexibility services from local DERs for solving possible contingencies and it needs also to quantify how much they cost, compared to conventional planning actions based on network reinforcement. However, this comparison must be based also on the risk of these new planning choices, because one common question from all distribution system actors is how much reliable the flexibility from DER will be.