def clean_esi_string(esi):
    """Given ESI string (e.g. from shapefile), return a single numeric value.

    Notes:
    - If no code is given, it is filled with the middle values 5 (on scale from 1 - 10)
    - Some codes have letters appended to end of number to distinguish sub-types, these are stripped
    - If there are more than 1 code, the high value is returned
    """
    codes = str(esi).split('/')

    esi_vals = []
    for code in codes:
        # if there is no code: give 5 as medium
        if code == 'None':
            code = 5
        # remove letter at end of string
        elif not code.isnumeric():
            code = code[:-1]
        esi_vals.append(int(code))

    # return the higest sensitivity
    return max(esi_vals)