def Assign_criticality(roads_SN_POI):
    """
    This function calculates the criticality score for the road network.
    Criticality is assigned based on the criteria outlined in Hayes et al.

    Parameters
    ----------
    roads_SN_POI : GeoDataFrame that is the output of the Assign_community_faciities function

    Returns
    ----------
    GeoDataFrame that contains the criticality score obtained for the road network (Criticality score)
    """
    print("Merging road networks")
    roads_criticality = roads_SN_POI

    print("Calculating criticality")
    roads_criticality['Criticality'] = (roads_criticality['Node score'] * 0.33) + \
                                       (roads_criticality['Priority'] * 0.33) + \
                                       (roads_criticality['hierarchy'] * 0.33)
    # Percentile_25 = roads_criticality.Criticality.quantile(0.25)
    Percentile_50 = roads_SN_POI.Criticality.quantile(0.50)
    Percentile_90 = roads_criticality.Criticality.quantile(0.90)
    Percentile_99 = roads_criticality.Criticality.quantile(0.99)

    print("Assigning criticality score")
    roads_criticality.loc[roads_criticality['Criticality'] <= Percentile_50, 'Criticality score'] = 1
    roads_criticality.loc[roads_criticality['Criticality'] > Percentile_50, 'Criticality score'] = 10
    roads_criticality.loc[roads_criticality['Criticality'] > Percentile_90, 'Criticality score'] = 100
    roads_criticality.loc[roads_criticality['Criticality'] > Percentile_99, 'Criticality score'] = 1000

    return(roads_criticality)