def assign_minmax_travel_speeds_province_roads_apply(x):
    """Assign travel speeds to roads assets in Vietnam

    The speeds are assigned based on our understanding of:

    1. The types of assets
    2. The levels of classification of assets: 0-National, 1-Provinical, 2-Local, 3-Other
    3. The terrain where the assets are located: Flat or Mountain or No information

    Parameters
        x - Pandas dataframe with values
            - code - Numeric code for type of asset
            - level - Numeric code for level of asset
            - terrain - String value of the terrain of asset

    Returns
        - Float minimum assigned speed in km/hr
        - Float maximum assigned speed in km/hr
    """
    asset_code = x.code
    asset_level = x.level
    asset_terrain = x.terrain

    if (not asset_terrain) or ('flat' in asset_terrain.lower()):
        if asset_code == 17:
            # This is an expressway
            return 100, 120
        elif asset_code in (15, 4):
            # This is a residential road or a mountain pass
            return 40, 60
        elif asset_level == 0:
            # This is any other national network asset
            return 80, 100
        elif asset_level == 1:
            # This is any other provincial network asset
            return 60, 80
        elif asset_level == 2:
            # This is any other local network asset
            return 40, 60
        else:
            # Anything else not included above
            return 20, 40

    else:
        if asset_level < 3:
            return 40, 60
        else:
            return 20, 40