def assign_road_surface(x):
    """Assign road surface to roads

    Parameters
        x - Pandas DataFrame of values
            - road_type - String name for type of road: national, province or rural
            - material_code - String code for road materials: 
                [('A','Asfalto'),('H','Hormigon'), ('R','Ripio'), ('T','Tierra'), ('B','Tratamiento')]
            - surface - String name of already assigned road surface 

    Returns
        String value of road surface as one or more of: 
            ['Asfalto','Hormigon', 'Ripio', 'Tierra','Tratamiento']
    """
    asset_type = str(x.road_type).lower().strip()


    # This is an national and provincial roads with paved surfaces
    '''A - Asphalt, H - Hormigon, R - Ripio, T - Tierra, B - Tratamiento
    '''
    matrerial_surfaces = [('A','Asfalto'),('H','Hormigon'), ('R','Ripio'), ('T','Tierra'), ('B','Tratamiento')]
    if asset_type == 'national':
        if str(x.material_code) != '0':
            ml = x.material_code.split(',')
            s = []
            for ms in matrerial_surfaces:
                if ms[0] in ml:
                    s.append(ms[1])

            return ','.join(s)
        else:
            return 'Asfalto'
    elif str(x.surface).lower().strip() != '0':
        # Anything else not included above
        return x.surface.title()
    else:
        return 'Tierra'